diff --git a/Gemfile b/Gemfile index 37037d81713..0cbe5e89dbf 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" } ruby '~> 2.6.5' -gem 'rails', '~> 6.0.0' +gem 'rails', '~> 6.1.0' gem 'ahoy_matey', '~> 3.0' gem 'american_date' diff --git a/Gemfile.lock b/Gemfile.lock index bb718319b9f..70d24c833e4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,61 +86,65 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.0.3.4) - actionpack (= 6.0.3.4) + actioncable (6.1.0) + actionpack (= 6.1.0) + activesupport (= 6.1.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.3.4) - actionpack (= 6.0.3.4) - activejob (= 6.0.3.4) - activerecord (= 6.0.3.4) - activestorage (= 6.0.3.4) - activesupport (= 6.0.3.4) + actionmailbox (6.1.0) + actionpack (= 6.1.0) + activejob (= 6.1.0) + activerecord (= 6.1.0) + activestorage (= 6.1.0) + activesupport (= 6.1.0) mail (>= 2.7.1) - actionmailer (6.0.3.4) - actionpack (= 6.0.3.4) - actionview (= 6.0.3.4) - activejob (= 6.0.3.4) + actionmailer (6.1.0) + actionpack (= 6.1.0) + actionview (= 6.1.0) + activejob (= 6.1.0) + activesupport (= 6.1.0) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.3.4) - actionview (= 6.0.3.4) - activesupport (= 6.0.3.4) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.0) + actionview (= 6.1.0) + activesupport (= 6.1.0) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.3.4) - actionpack (= 6.0.3.4) - activerecord (= 6.0.3.4) - activestorage (= 6.0.3.4) - activesupport (= 6.0.3.4) + actiontext (6.1.0) + actionpack (= 6.1.0) + activerecord (= 6.1.0) + activestorage (= 6.1.0) + activesupport (= 6.1.0) nokogiri (>= 1.8.5) - actionview (6.0.3.4) - activesupport (= 6.0.3.4) + actionview (6.1.0) + activesupport (= 6.1.0) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.3.4) - activesupport (= 6.0.3.4) + activejob (6.1.0) + activesupport (= 6.1.0) globalid (>= 0.3.6) - activemodel (6.0.3.4) - activesupport (= 6.0.3.4) - activerecord (6.0.3.4) - activemodel (= 6.0.3.4) - activesupport (= 6.0.3.4) - activestorage (6.0.3.4) - actionpack (= 6.0.3.4) - activejob (= 6.0.3.4) - activerecord (= 6.0.3.4) + activemodel (6.1.0) + activesupport (= 6.1.0) + activerecord (6.1.0) + activemodel (= 6.1.0) + activesupport (= 6.1.0) + activestorage (6.1.0) + actionpack (= 6.1.0) + activejob (= 6.1.0) + activerecord (= 6.1.0) + activesupport (= 6.1.0) marcel (~> 0.3.1) - activesupport (6.0.3.4) + mimemagic (~> 0.3.2) + activesupport (6.1.0) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) aes_key_wrap (1.1.0) @@ -459,20 +463,20 @@ GEM rack_session_access (0.2.0) builder (>= 2.0.0) rack (>= 1.0.0) - rails (6.0.3.4) - actioncable (= 6.0.3.4) - actionmailbox (= 6.0.3.4) - actionmailer (= 6.0.3.4) - actionpack (= 6.0.3.4) - actiontext (= 6.0.3.4) - actionview (= 6.0.3.4) - activejob (= 6.0.3.4) - activemodel (= 6.0.3.4) - activerecord (= 6.0.3.4) - activestorage (= 6.0.3.4) - activesupport (= 6.0.3.4) - bundler (>= 1.3.0) - railties (= 6.0.3.4) + rails (6.1.0) + actioncable (= 6.1.0) + actionmailbox (= 6.1.0) + actionmailer (= 6.1.0) + actionpack (= 6.1.0) + actiontext (= 6.1.0) + actionview (= 6.1.0) + activejob (= 6.1.0) + activemodel (= 6.1.0) + activerecord (= 6.1.0) + activestorage (= 6.1.0) + activesupport (= 6.1.0) + bundler (>= 1.15.0) + railties (= 6.1.0) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -491,12 +495,12 @@ GEM rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) - railties (6.0.3.4) - actionpack (= 6.0.3.4) - activesupport (= 6.0.3.4) + railties (6.1.0) + actionpack (= 6.1.0) + activesupport (= 6.1.0) method_source rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + thor (~> 1.0) rainbow (3.0.0) raise-if-root (0.0.2) rake (13.0.3) @@ -628,8 +632,8 @@ GEM tpm-key_attestation (0.10.0) bindata (~> 2.4) openssl-signature_algorithm (~> 1.0) - tzinfo (1.2.9) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unicode-display_width (1.7.0) @@ -760,7 +764,7 @@ DEPENDENCIES rack-test (>= 1.1.0) rack-timeout rack_session_access (>= 0.2.0) - rails (~> 6.0.0) + rails (~> 6.1.0) rails-controller-testing (>= 1.0.4) rails-erd (>= 1.6.0) raise-if-root diff --git a/app/controllers/test/saml_test_controller.rb b/app/controllers/test/saml_test_controller.rb index 24a1684f0ac..3dc0d437b41 100644 --- a/app/controllers/test/saml_test_controller.rb +++ b/app/controllers/test/saml_test_controller.rb @@ -43,7 +43,7 @@ def test_saml_settings def render_template_for(validity, response) render( - template: 'test/saml_test/decode_response.html.erb', + template: 'test/saml_test/decode_response', locals: { is_valid: validity, response: response }, ) end diff --git a/app/decorators/phone_configuration_decorator.rb b/app/decorators/phone_configuration_decorator.rb deleted file mode 100644 index fa08c8389d7..00000000000 --- a/app/decorators/phone_configuration_decorator.rb +++ /dev/null @@ -1,6 +0,0 @@ -PhoneConfigurationDecorator = Struct.new(:phone_configuration) do - def default_number_message - I18n.t('account.index.default') if - phone_configuration == phone_configuration.user.default_phone_configuration - end -end diff --git a/app/models/phone_configuration.rb b/app/models/phone_configuration.rb index a8653579dd2..56f0cd0ef28 100644 --- a/app/models/phone_configuration.rb +++ b/app/models/phone_configuration.rb @@ -8,10 +8,6 @@ class PhoneConfiguration < ApplicationRecord enum delivery_preference: { sms: 0, voice: 1 } - def decorate - PhoneConfigurationDecorator.new(self) - end - def formatted_phone Phonelib.parse(phone).international end diff --git a/app/views/accounts/_auth_apps.html.erb b/app/views/accounts/_auth_apps.html.erb index 74fe7f3a743..2d3c99fa9d5 100644 --- a/app/views/accounts/_auth_apps.html.erb +++ b/app/views/accounts/_auth_apps.html.erb @@ -21,9 +21,6 @@
<%= auth_app_configuration.name %>
-
- <%= PhoneConfigurationDecorator.new(auth_app_configuration).default_number_message %> -
<%= render @view_model.totp_partial, id: auth_app_configuration.id %> diff --git a/app/views/accounts/_phone.html.erb b/app/views/accounts/_phone.html.erb index d8fbd2711e5..107b5a7d49b 100644 --- a/app/views/accounts/_phone.html.erb +++ b/app/views/accounts/_phone.html.erb @@ -21,7 +21,9 @@ <%= phone_configuration.phone %>
- <%= PhoneConfigurationDecorator.new(phone_configuration).default_number_message %> + <% if current_user.default_phone_configuration == phone_configuration %> + <%= I18n.t('account.index.default') %> + <% end %>
<%= render @view_model.manage_action_partial, diff --git a/app/views/accounts/_piv_cac.html.erb b/app/views/accounts/_piv_cac.html.erb index 851b81b0417..8521f93d123 100644 --- a/app/views/accounts/_piv_cac.html.erb +++ b/app/views/accounts/_piv_cac.html.erb @@ -21,9 +21,6 @@
<%= piv_cac_configuration.name %>
-
- <%= PhoneConfigurationDecorator.new(piv_cac_configuration).default_number_message %> -
<%= render @view_model.piv_cac_partial, id: piv_cac_configuration.id %> diff --git a/bin/webpack b/bin/webpack index 465832722c9..1031168d012 100755 --- a/bin/webpack +++ b/bin/webpack @@ -7,9 +7,12 @@ require "pathname" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath) -require "rubygems" require "bundler/setup" require "webpacker" require "webpacker/webpack_runner" -Webpacker::WebpackRunner.run(ARGV) + +APP_ROOT = File.expand_path("..", __dir__) +Dir.chdir(APP_ROOT) do + Webpacker::WebpackRunner.run(ARGV) +end diff --git a/bin/webpack-dev-server b/bin/webpack-dev-server index faa69f07800..dd9662737a6 100755 --- a/bin/webpack-dev-server +++ b/bin/webpack-dev-server @@ -7,9 +7,12 @@ require "pathname" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath) -require "rubygems" require "bundler/setup" require "webpacker" require "webpacker/dev_server_runner" -Webpacker::DevServerRunner.run(ARGV) + +APP_ROOT = File.expand_path("..", __dir__) +Dir.chdir(APP_ROOT) do + Webpacker::DevServerRunner.run(ARGV) +end diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 00000000000..241546e51d6 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby +require 'pathname' + +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do + executable_path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path| + normalized_path = File.expand_path(path) + + normalized_path != __dir__ && File.executable?(Pathname.new(normalized_path).join('yarn')) + end + + if executable_path + exec File.expand_path(Pathname.new(executable_path).join('yarn')), *ARGV + else + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index 3d4381cf4c7..0a9475876fd 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,5 +1,12 @@ require_relative 'boot' -require 'rails/all' + +require 'active_record/railtie' +require 'action_controller/railtie' +require 'action_view/railtie' +require 'action_mailer/railtie' +require 'rails/test_unit/railtie' +require 'sprockets/railtie' + require_relative '../lib/upaya_log_formatter' require_relative '../lib/app_config' require_relative '../lib/fingerprinter' @@ -12,17 +19,19 @@ module Upaya class Application < Rails::Application AppConfig.setup(YAML.safe_load(File.read(Rails.root.join('config', 'application.yml')))) - config.load_defaults '6.0' + config.load_defaults '6.1' config.active_record.belongs_to_required_by_default = false config.assets.unknown_asset_fallback = true - # We can enable this once we know we're not rolling back from Rails 6 - # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#purpose-in-signed-or-encrypted-cookie-is-now-embedded-within-cookies - config.action_dispatch.use_cookies_with_metadata = false - config.active_job.queue_adapter = 'inline' config.time_zone = 'UTC' + # Generate CSRF tokens that are encoded in URL-safe Base64. + # + # This change is not backwards compatible with earlier Rails versions. + # It's best enabled when your entire app is migrated and stable on 6.1. + Rails.application.config.action_controller.urlsafe_csrf_tokens = false + config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{yml}')] config.i18n.available_locales = AppConfig.env.available_locales.try(:split, ' ') || %w[en] config.i18n.default_locale = :en diff --git a/config/environments/development.rb b/config/environments/development.rb index 542918abd59..b69ba73d2a6 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -10,7 +10,16 @@ config.assets.debug = true config.assets.digest = true config.assets.raise_runtime_errors = true - config.action_view.raise_on_missing_translations = true + config.i18n.raise_on_missing_translations = true + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Annotate rendered view with file names. + config.action_view.annotate_rendered_view_with_filenames = true config.action_mailer.default_url_options = { host: AppConfig.env.domain_name, diff --git a/config/environments/production.rb b/config/environments/production.rb index c70b94fde70..b474de2e21d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -7,7 +7,7 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true - config.action_controller.asset_host = proc do |_source, request| + config.asset_host = proc do |_source, request| # we want precompiled assets to have domain-agnostic URLs # and request is nil during asset precompilation (AppConfig.env.asset_host || AppConfig.env.domain_name) if request diff --git a/config/environments/test.rb b/config/environments/test.rb index 915dc344093..9472a87eae5 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -12,7 +12,7 @@ config.action_controller.allow_forgery_protection = false config.active_support.test_order = :random config.active_support.deprecation = :stderr - config.action_view.raise_on_missing_translations = true + config.i18n.raise_on_missing_translations = true config.action_mailer.delivery_method = :test config.action_mailer.default_url_options = { host: AppConfig.env.domain_name } @@ -20,6 +20,15 @@ config.assets.debug = false + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + config.action_controller.asset_host = if ENV.key?('RAILS_ASSET_HOST') ENV['RAILS_ASSET_HOST'] else diff --git a/package.json b/package.json index c116f5614e3..0bebd791b11 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,13 @@ }, "dependencies": { "basscss-sass": "^3.0.0", + "@babel/core": "^7.12.10", + "@babel/eslint-parser": "^7.12.1", + "@babel/eslint-plugin": "^7.12.1", + "@babel/plugin-proposal-class-properties": "^7.12.1", + "@babel/preset-env": "^7.12.11", + "@babel/preset-react": "^7.12.10", + "@babel/register": "^7.12.10", "classlist-polyfill": "^1.2.0", "cleave.js": "^1.6.0", "clipboard": "^2.0.6", @@ -28,18 +35,13 @@ "libphonenumber-js": "^1.9.6", "react": "^17.0.1", "react-dom": "^17.0.1", + "@rails/webpacker": "^5.2.1", + "postcss-clean": "^1.1.0", + "source-map-loader": "^1.1.3", "zxcvbn": "^4.4.2" }, "devDependencies": { - "@babel/core": "^7.12.10", - "@babel/eslint-parser": "^7.12.1", - "@babel/eslint-plugin": "^7.12.1", - "@babel/plugin-proposal-class-properties": "^7.12.1", - "@babel/preset-env": "^7.12.11", - "@babel/preset-react": "^7.12.10", - "@babel/register": "^7.12.10", "@peculiar/webcrypto": "^1.1.4", - "@rails/webpacker": "^5.2.1", "@testing-library/dom": "^7.29.0", "@testing-library/react": "^11.2.2", "@testing-library/react-hooks": "^3.7.0", @@ -56,11 +58,9 @@ "eslint-plugin-react-hooks": "^4.2.0", "jsdom": "^16.4.0", "mocha": "^8.2.1", - "postcss-clean": "^1.1.0", "prettier": "^2.2.1", "react-test-renderer": "^17.0.1", "sinon": "^9.2.2", - "source-map-loader": "^1.1.3", "typescript": "^4.1.3", "webpack-dev-server": "^3.11.1" } diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 2c2eae4ab2d..09d9dad13ae 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -11,7 +11,7 @@ def index it 'sets headers to disable cache' do get :index - expect(response.headers['Cache-Control']).to eq 'private, no-store' + expect(response.headers['Cache-Control']).to eq 'no-store' expect(response.headers['Pragma']).to eq 'no-cache' end end @@ -281,7 +281,7 @@ def index it 'returns a 400 bad request when a url generation error is raised on the redirect' do allow_any_instance_of(ApplicationController).to \ - receive(:redirect_to).and_raise(ActionController::UrlGenerationError) + receive(:redirect_to).and_raise(ActionController::UrlGenerationError.new('bad request')) allow(subject).to receive(:current_user).and_return(user) get :index, params: { timeout: true, request_id: '123' } diff --git a/spec/decorators/phone_configuration_decorator_spec.rb b/spec/decorators/phone_configuration_decorator_spec.rb deleted file mode 100644 index d9ab9b5ac84..00000000000 --- a/spec/decorators/phone_configuration_decorator_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'rails_helper' - -describe PhoneConfigurationDecorator do - before do - @user = create(:user, email: 'test1@test.com') - @phone_config = create(:phone_configuration, user: @user, - phone: '+1 111 111 1111', - made_default_at: Time.zone.now) - end - - describe '#default_number_message' do - it 'returns the default message for default_phone_configuration' do - decorator = PhoneConfigurationDecorator.new(@phone_config) - - expect(decorator.default_number_message).to eq t('account.index.default') - end - end -end diff --git a/spec/features/saml/ial1_sso_spec.rb b/spec/features/saml/ial1_sso_spec.rb index 0b5d6ead4f4..e72d5b186df 100644 --- a/spec/features/saml/ial1_sso_spec.rb +++ b/spec/features/saml/ial1_sso_spec.rb @@ -22,7 +22,6 @@ expect(page).to have_content email expect(page).to_not have_content t('help_text.requested_attributes.address') expect(page).to_not have_content t('help_text.requested_attributes.birthdate') - expect(page).to_not have_content t('help_text.requested_attributes.name') expect(page).to_not have_content t('help_text.requested_attributes.phone') expect(page). to_not have_content t('help_text.requested_attributes.social_security_number') diff --git a/spec/features/two_factor_authentication/sign_in_spec.rb b/spec/features/two_factor_authentication/sign_in_spec.rb index 0659e9453b3..3e908837a6d 100644 --- a/spec/features/two_factor_authentication/sign_in_spec.rb +++ b/spec/features/two_factor_authentication/sign_in_spec.rb @@ -177,14 +177,6 @@ def attempt_to_bypass_2fa expect(Telephony::Test::Message.messages.length).to eq(1) expect(Telephony::Test::Call.calls.length).to eq(1) end - - scenario 'the user cannot change delivery method if phone is unsupported' do - unsupported_phone = '+1 (242) 327-0143' - user = create(:user, :signed_up, with: { phone: unsupported_phone }) - sign_in_before_2fa(user) - - expect(page).to_not have_link t('links.two_factor_authentication.voice') - end end describe 'when the user is PIV/CAC enabled' do @@ -289,7 +281,7 @@ def attempt_to_bypass_2fa user = create(:user, :signed_up) sign_in_before_2fa(user) - expect(page).not_to have_link(t('two_factor_authentication.piv_cac_fallback.link')) + expect(page).not_to have_link(t('two_factor_authentication.piv_cac_fallback.question')) end end diff --git a/spec/features/users/sign_in_spec.rb b/spec/features/users/sign_in_spec.rb index afc7b28be75..c99a4416974 100644 --- a/spec/features/users/sign_in_spec.rb +++ b/spec/features/users/sign_in_spec.rb @@ -691,7 +691,7 @@ it 'does not display OTP Fallback text and links' do expect(page). - to_not have_content t('two_factor_authentication.totp_fallback.sms_link_text') + to_not have_content t('two_factor_authentication.phone_fallback.question') end end diff --git a/spec/features/users/sign_up_spec.rb b/spec/features/users/sign_up_spec.rb index 5eb83a0380f..a0bee5aa063 100644 --- a/spec/features/users/sign_up_spec.rb +++ b/spec/features/users/sign_up_spec.rb @@ -68,10 +68,6 @@ it 'sends them to the cancel page' do expect(current_path).to eq sign_up_cancel_path end - - it 'does not display a link to get back to their account' do - expect(page).to_not have_content t('links.back_to_account') - end end context 'user cancels on MFA screen', email: true do @@ -84,10 +80,6 @@ it 'sends them to the cancel page' do expect(current_path).to eq sign_up_cancel_path end - - it 'does not display a link to get back to their account' do - expect(page).to_not have_content t('links.back_to_account') - end end context 'user cancels with language preference set' do diff --git a/spec/forms/idv/api_document_verification_form_spec.rb b/spec/forms/idv/api_document_verification_form_spec.rb index 0c5a1d5a001..87030e79641 100644 --- a/spec/forms/idv/api_document_verification_form_spec.rb +++ b/spec/forms/idv/api_document_verification_form_spec.rb @@ -44,7 +44,7 @@ it 'is not valid' do expect(form.valid?).to eq(false) - expect(form.errors.keys).to eq([:selfie_image_url]) + expect(form.errors.attribute_names).to eq([:selfie_image_url]) expect(form.errors[:selfie_image_url]).to eq([t('doc_auth.errors.not_a_file')]) end end @@ -64,7 +64,7 @@ it 'is not valid' do expect(form.valid?).to eq(false) - expect(form.errors.keys).to eq([:front_image_iv]) + expect(form.errors.attribute_names).to eq([:front_image_iv]) expect(form.errors[:front_image_iv]).to eq(['Please fill in this field.']) end end @@ -74,7 +74,7 @@ it 'is not valid' do expect(form.valid?).to eq(false) - expect(form.errors.keys).to eq([:encryption_key]) + expect(form.errors.attribute_names).to eq([:encryption_key]) expect(form.errors[:encryption_key]).to eq(['Please fill in this field.']) end end @@ -84,7 +84,7 @@ it 'is not valid' do expect(form.valid?).to eq(false) - expect(form.errors.keys).to eq([:front_image_url]) + expect(form.errors.attribute_names).to eq([:front_image_url]) expect(form.errors[:front_image_url]).to eq([t('doc_auth.errors.not_a_file')]) end end @@ -94,7 +94,7 @@ it 'is not valid' do expect(form.valid?).to eq(false) - expect(form.errors.keys).to eq([:document_capture_session]) + expect(form.errors.attribute_names).to eq([:document_capture_session]) expect(form.errors[:document_capture_session]).to eq(['Please fill in this field.']) end end @@ -104,7 +104,7 @@ it 'is not valid' do expect(form.valid?).to eq(false) - expect(form.errors.keys).to eq([:document_capture_session]) + expect(form.errors.attribute_names).to eq([:document_capture_session]) expect(form.errors[:document_capture_session]).to eq(['Please fill in this field.']) end end @@ -117,7 +117,7 @@ it 'is not valid' do expect(form.valid?).to eq(false) - expect(form.errors.keys).to eq([:limit]) + expect(form.errors.attribute_names).to eq([:limit]) expect(form.errors[:limit]).to eq([I18n.t('errors.doc_auth.acuant_throttle')]) end end diff --git a/spec/models/phone_configuration_spec.rb b/spec/models/phone_configuration_spec.rb index d85d7e31c5f..21cc6c14cc7 100644 --- a/spec/models/phone_configuration_spec.rb +++ b/spec/models/phone_configuration_spec.rb @@ -30,12 +30,4 @@ end end end - - describe '#decorate' do - it 'returns a PhoneConfigurationDecorator' do - phone_configuration = build(:phone_configuration) - - expect(phone_configuration.decorate).to be_a(PhoneConfigurationDecorator) - end - end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index c8102bea954..ff708b8080e 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -15,6 +15,7 @@ ENV['RAILS_ENV'] = 'test' require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_unit/railtie' require 'rspec/rails' require 'spec_helper' require 'email_spec' diff --git a/spec/support/idv_examples/clearing_and_restarting.rb b/spec/support/idv_examples/clearing_and_restarting.rb index 2d8ab0e97c6..835f3e0d99a 100644 --- a/spec/support/idv_examples/clearing_and_restarting.rb +++ b/spec/support/idv_examples/clearing_and_restarting.rb @@ -44,7 +44,7 @@ visit account_path - expect(page).to_not have_content(t('heading.account.profile_info')) + expect(page).to_not have_content(t('headings.account.profile_info')) expect(page).to_not have_content(t('account.index.address')) expect(page).to_not have_content(t('account.index.dob')) expect(page).to_not have_content(t('account.index.full_name')) diff --git a/spec/views/accounts/_nav_auth.html.erb_spec.rb b/spec/views/accounts/_nav_auth.html.erb_spec.rb index 31b9900346e..7780458c970 100644 --- a/spec/views/accounts/_nav_auth.html.erb_spec.rb +++ b/spec/views/accounts/_nav_auth.html.erb_spec.rb @@ -11,7 +11,7 @@ context 'user is signed in' do before do - render partial: 'accounts/nav_auth.html.erb', locals: { enable_mobile_nav: false } + render partial: 'accounts/nav_auth', locals: { enable_mobile_nav: false } end it 'contains welcome message' do @@ -29,7 +29,7 @@ context 'mobile nav is enabled' do before do - render partial: 'accounts/nav_auth.html.erb', locals: { enable_mobile_nav: true } + render partial: 'accounts/nav_auth', locals: { enable_mobile_nav: true } end it 'contains menu button' do diff --git a/spec/views/idv/doc_auth/upload.html.erb_spec.rb b/spec/views/idv/doc_auth/upload.html.erb_spec.rb index c77f7d07298..991e3038e6f 100644 --- a/spec/views/idv/doc_auth/upload.html.erb_spec.rb +++ b/spec/views/idv/doc_auth/upload.html.erb_spec.rb @@ -20,7 +20,7 @@ context 'with liveness enabled' do it 'renders liveness content' do allow(view).to receive(:liveness_checking_enabled?).and_return(true) - render template: 'idv/doc_auth/upload.html.erb' + render template: 'idv/doc_auth/upload' expect(rendered).to have_content(t('doc_auth.headings.upload_liveness_enabled')) expect(rendered).to have_content(t('doc_auth.info.upload_liveness_enabled')) @@ -31,7 +31,7 @@ context 'with liveness disabled' do it 'does not render liveness content' do allow(view).to receive(:liveness_checking_enabled?).and_return(false) - render template: 'idv/doc_auth/upload.html.erb' + render template: 'idv/doc_auth/upload' expect(rendered).to have_content(t('doc_auth.headings.upload')) expect(rendered).to have_content(t('doc_auth.info.upload')) @@ -41,7 +41,7 @@ context 'without service provider' do it 'does not render fallback support link' do - render template: 'idv/doc_auth/upload.html.erb' + render template: 'idv/doc_auth/upload' link_text = t( 'doc_auth.info.no_other_id_help_bold_html', @@ -57,7 +57,7 @@ let(:sp_name) { 'Example App' } it 'renders fallback support link' do - render template: 'idv/doc_auth/upload.html.erb' + render template: 'idv/doc_auth/upload' link_text = t( 'doc_auth.info.no_other_id_help_bold_html', diff --git a/spec/views/idv/doc_auth/welcome.html.erb_spec.rb b/spec/views/idv/doc_auth/welcome.html.erb_spec.rb index b1612767730..69354378486 100644 --- a/spec/views/idv/doc_auth/welcome.html.erb_spec.rb +++ b/spec/views/idv/doc_auth/welcome.html.erb_spec.rb @@ -13,7 +13,7 @@ context 'in doc auth with an authenticated user' do it 'renders a link to return to the SP' do - render template: 'idv/doc_auth/welcome.html.erb' + render template: 'idv/doc_auth/welcome' expect(rendered).to have_link(t('links.cancel')) end @@ -23,7 +23,7 @@ let(:user_fully_authenticated) { false } it 'renders a link to return to the MFA step' do - render template: 'idv/doc_auth/welcome.html.erb' + render template: 'idv/doc_auth/welcome' expect(rendered).to have_link(t('two_factor_authentication.choose_another_option')) end @@ -35,7 +35,7 @@ end it 'renders selfie instructions' do - render template: 'idv/doc_auth/welcome.html.erb' + render template: 'idv/doc_auth/welcome' expect(rendered).to have_text(t('doc_auth.instructions.bullet1a')) end @@ -47,7 +47,7 @@ end it 'renders selfie instructions' do - render template: 'idv/doc_auth/welcome.html.erb' + render template: 'idv/doc_auth/welcome' expect(rendered).to_not have_text(t('doc_auth.instructions.bullet1a')) end @@ -68,7 +68,7 @@ end it 'renders the warning banner but no other content' do - render template: 'idv/doc_auth/welcome.html.erb' + render template: 'idv/doc_auth/welcome' expect(rendered).to have_content('We are currently under maintenance') expect(rendered).to_not have_content(t('doc_auth.headings.welcome')) diff --git a/spec/views/two_factor_authentication/otp_verification/show.html.erb_spec.rb b/spec/views/two_factor_authentication/otp_verification/show.html.erb_spec.rb index 6138c7faf14..c7000cab695 100644 --- a/spec/views/two_factor_authentication/otp_verification/show.html.erb_spec.rb +++ b/spec/views/two_factor_authentication/otp_verification/show.html.erb_spec.rb @@ -125,34 +125,6 @@ end end - context 'user is unconfirmed' do - it 'does not provide an option to use a personal key' do - unconfirmed_data = presenter_data.merge(personal_key_unavailable: true) - - @presenter = TwoFactorAuthCode::PhoneDeliveryPresenter.new( - data: unconfirmed_data, - view: view, - ) - - render - - expect(rendered).not_to have_link( - t('two_factor_authentication.personal_key_fallback.link'), - href: login_two_factor_personal_key_path, - ) - end - end - - context 'when totp is not enabled' do - it 'does not allow user to sign in using an authenticator app' do - render - - expect(rendered).not_to have_link( - t('links.two_factor_authentication.app'), href: login_two_factor_authenticator_path - ) - end - end - context 'when totp is enabled' do it 'allows user to sign in using an authenticator app' do totp_data = presenter_data.merge(totp_enabled: true)