-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make paranoid option return success status code and message regardles…
…s of result (#1524)
- Loading branch information
Keith Doggett
authored
Mar 16, 2022
1 parent
23d6b81
commit 798255e
Showing
6 changed files
with
49 additions
and
18 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
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
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
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 |
---|---|---|
|
@@ -171,21 +171,30 @@ def token_and_client_config_from(body) | |
test 'response should contain message' do | ||
assert_equal @data['message'], I18n.t('devise_token_auth.confirmations.sended_paranoid', email: @resource.email) | ||
end | ||
|
||
test 'response should return success status' do | ||
assert_equal 200, response.status | ||
end | ||
end | ||
|
||
describe 'on failure' do | ||
before do | ||
swap Devise, paranoid: true do | ||
@email = '[email protected]' | ||
post :create, | ||
params: { email: '[email protected]', | ||
params: { email: @email, | ||
redirect_url: @redirect_url }, | ||
xhr: true | ||
@data = JSON.parse(response.body) | ||
end | ||
end | ||
|
||
test 'response should contain errors' do | ||
assert_equal @data['errors'], [I18n.t('devise_token_auth.confirmations.sended_paranoid')] | ||
test 'response should not contain errors' do | ||
assert_equal @data['message'], I18n.t('devise_token_auth.confirmations.sended_paranoid', email: @email) | ||
end | ||
|
||
test 'response should return success status' do | ||
assert_equal 200, response.status | ||
end | ||
end | ||
end | ||
|
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
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