Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions spec/features/users/sign_up_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,22 @@

sign_up_and_set_password

freeze_time do
(IdentityConfig.store.phone_confirmation_max_attempts + 1).times do
visit phone_setup_path
fill_in 'new_phone_form_phone', with: '2025551313'
click_send_one_time_code
end
(IdentityConfig.store.phone_confirmation_max_attempts + 1).times do
visit phone_setup_path
fill_in 'new_phone_form_phone', with: '2025551313'
click_send_one_time_code
end

timeout = distance_of_time_in_words(
Throttle.attempt_window_in_minutes(:phone_confirmation).minutes,
)
# whether it says '9 minutes' or '10 minutes' depends on how
# slowly the test runs.
throttled_message = I18n.t(
'errors.messages.phone_confirmation_throttled',
timeout: '(10|9) minutes',
)

expect(current_path).to eq(authentication_methods_setup_path)
expect(page).to have_content(
I18n.t(
'errors.messages.phone_confirmation_throttled',
timeout: timeout,
),
)
end
expect(current_path).to eq(authentication_methods_setup_path)

expect(page).to have_content(/#{throttled_message}/)
end

context 'with js', js: true do
Expand Down
1 change: 1 addition & 0 deletions spec/views/layouts/application.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
it 'it render the new relic javascript' do
allow(IdentityConfig.store).to receive(:newrelic_browser_key).and_return('foo')
allow(IdentityConfig.store).to receive(:newrelic_browser_app_id).and_return('foo')
allow(BrowserSupport).to receive(:supported?).and_return(true)

render

Expand Down