Skip to content

Commit

Permalink
Fix CurrentUserSpecHelper after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoHolo committed Jan 7, 2021
1 parent 7444cac commit 632a402
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions spec/support/current_user_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,28 @@ def current_user_id
'208294780284604222681'
end

def current_user
def current_user_token
{
'name' => 'Test User',
'email' => '[email protected]',
'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
Expand Down

0 comments on commit 632a402

Please sign in to comment.