Skip to content

Commit

Permalink
Fix registration spec failure (#1613)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaicolBen authored Nov 6, 2023
1 parent 03b9f7a commit dd27c7f
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions test/controllers/devise_token_auth/registrations_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DeviseTokenAuth::RegistrationsControllerTest < ActionDispatch::Integration

def mock_registration_params
{
email: Faker::Internet.email,
email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: Faker::Internet.url,
Expand Down Expand Up @@ -152,7 +152,7 @@ def mock_registration_params

test 'request to whitelisted redirect should be successful' do
post '/auth',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: @good_redirect_url,
Expand All @@ -163,7 +163,7 @@ def mock_registration_params

test 'request to non-whitelisted redirect should fail' do
post '/auth',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: @bad_redirect_url,
Expand All @@ -181,7 +181,7 @@ def mock_registration_params
describe 'failure if not redirecturl' do
test 'request should fail if not redirect_url' do
post '/auth',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
unpermitted_param: '(x_x)' }
Expand All @@ -191,7 +191,7 @@ def mock_registration_params

test 'request to non-whitelisted redirect should fail' do
post '/auth',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
unpermitted_param: '(x_x)' }
Expand All @@ -210,7 +210,7 @@ def mock_registration_params
DeviseTokenAuth.default_confirm_success_url = @redirect_url

assert_difference 'ActionMailer::Base.deliveries.size', 1 do
post '/auth', params: { email: Faker::Internet.email,
post '/auth', params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
unpermitted_param: '(x_x)' }
Expand Down Expand Up @@ -240,7 +240,7 @@ def mock_registration_params
@mails_sent = ActionMailer::Base.deliveries.count

post '/api/v1/auth', params: {
email: Faker::Internet.email,
email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: Faker::Internet.url,
Expand Down Expand Up @@ -295,7 +295,7 @@ def mock_registration_params
@operating_thetan = 2

post '/auth',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: @redirect_url,
Expand Down Expand Up @@ -388,7 +388,7 @@ def mock_registration_params
describe 'Mismatched passwords' do
before do
post '/auth',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'bogus',
confirm_success_url: Faker::Internet.url }
Expand Down Expand Up @@ -505,7 +505,7 @@ def mock_registration_params
# test valid update param
@resource_class = User
@new_operating_thetan = 1_000_000
@email = Faker::Internet.email
@email = Faker::Internet.unique.email
@request_params = {
operating_thetan: @new_operating_thetan,
email: @email
Expand Down Expand Up @@ -612,7 +612,7 @@ def mock_registration_params
# test valid update param
@resource_class = User
@new_operating_thetan = 1_000_000
@email = Faker::Internet.email
@email = Faker::Internet.unique.email
@request_params = {
operating_thetan: @new_operating_thetan,
email: @email
Expand Down Expand Up @@ -663,7 +663,7 @@ def mock_registration_params
before do
DeviseTokenAuth.check_current_password_before_update = :password
@new_operating_thetan = 1_000_000
@email = Faker::Internet.email
@email = Faker::Internet.unique.email
end

after do
Expand Down Expand Up @@ -773,7 +773,7 @@ def mock_registration_params
describe 'Alternate user class' do
before do
post '/mangs',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: Faker::Internet.url }
Expand Down Expand Up @@ -814,7 +814,7 @@ def mock_registration_params
@config_name = 'altUser'

post '/mangs',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: Faker::Internet.url,
Expand All @@ -840,7 +840,7 @@ def mock_registration_params
test 'UnregisterableUser should not be able to access registration routes' do
assert_raises(ActionController::RoutingError) do
post '/unregisterable_user_auth',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: Faker::Internet.url }
Expand All @@ -853,7 +853,7 @@ def mock_registration_params
User.set_callback(:create, :before, :skip_confirmation!)

post '/auth',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: Faker::Internet.url }
Expand Down Expand Up @@ -893,7 +893,7 @@ def mock_registration_params
@mails_sent = ActionMailer::Base.deliveries.count

post '/only_email_auth',
params: { email: Faker::Internet.email,
params: { email: Faker::Internet.unique.email,
password: 'secret123',
password_confirmation: 'secret123',
confirm_success_url: Faker::Internet.url,
Expand Down

0 comments on commit dd27c7f

Please sign in to comment.