-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CurrentUserSpecHelper after rebase
- Loading branch information
Showing
1 changed file
with
14 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|