diff --git a/spec/features/users/sign_up_spec.rb b/spec/features/users/sign_up_spec.rb index 853bd294c36..69b75b4c49c 100644 --- a/spec/features/users/sign_up_spec.rb +++ b/spec/features/users/sign_up_spec.rb @@ -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 diff --git a/spec/views/layouts/application.html.erb_spec.rb b/spec/views/layouts/application.html.erb_spec.rb index 14e1dc36ff7..94d95663f0a 100644 --- a/spec/views/layouts/application.html.erb_spec.rb +++ b/spec/views/layouts/application.html.erb_spec.rb @@ -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