From 632a4028e7a4479f08c404ff5f03fbd9b1a6ca47 Mon Sep 17 00:00:00 2001 From: Arnaud Doucerain Date: Fri, 8 Jan 2021 00:49:50 +0100 Subject: [PATCH] Fix CurrentUserSpecHelper after rebase --- spec/support/current_user_spec_helper.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/spec/support/current_user_spec_helper.rb b/spec/support/current_user_spec_helper.rb index 11639ae..5ca5fb4 100644 --- a/spec/support/current_user_spec_helper.rb +++ b/spec/support/current_user_spec_helper.rb @@ -6,17 +6,28 @@ def current_user_id '208294780284604222681' end - def current_user + def current_user_token { 'name' => 'Test User', 'email' => 'testuser@octo.com', 'exp' => Time.zone.now.to_i + 10, - 'sub' => current_user_id + 'sub' => current_user_id, + 'photo' => 'https://photos.fr/test-user.jpg' } end + def save_current_user + before do + create :user, + id: current_user_token['sub'], + name: current_user_token['name'], + email: current_user_token['email'], + photo: current_user_token['photo'] + end + end + def headers_of_logged_in_user - allow(JWT).to receive(:decode).and_return([current_user]) + allow(JWT).to receive(:decode).and_return([current_user_token]) { AUTHORIZATION: 'Bearer WhateverToken' } end end