-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LG-14397: Remove use_fed_domain_class (#11326)
* LG-14397 Remove use_fed_domain_class config changelog: Internal, Configuration, Remove configuration not needed any longer * Fix incorrect example description * Add test for "email addresses" wihout domains
- Loading branch information
Showing
8 changed files
with
113 additions
and
285 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 |
---|---|---|
|
@@ -19,51 +19,19 @@ | |
) | ||
end | ||
|
||
context 'with user having gov or mil email and use_fed_domain_class set to false' do | ||
let(:user) do | ||
create(:user, email: '[email protected]', piv_cac_recommended_dismissed_at: Time.zone.now) | ||
end | ||
context 'with user having gov or mil email' do | ||
let!(:federal_domain) { create(:federal_email_domain, name: 'gsa.gov') } | ||
|
||
before do | ||
allow(IdentityConfig.store).to receive(:use_fed_domain_class).and_return(false) | ||
let(:user) do | ||
create( | ||
:user, | ||
email: '[email protected]', | ||
piv_cac_recommended_dismissed_at: interstitial_dismissed_at, | ||
) | ||
end | ||
|
||
context 'having already visited the PIV interstitial page' do | ||
it 'tracks the visit in analytics' do | ||
get :index | ||
|
||
expect(@analytics).to have_logged_event( | ||
'User Registration: 2FA Setup visited', | ||
enabled_mfa_methods_count: 0, | ||
gov_or_mil_email: true, | ||
) | ||
end | ||
end | ||
let(:interstitial_dismissed_at) { Time.zone.now } | ||
|
||
context 'directed to page without having visited PIV interstitial page' do | ||
let(:user) do | ||
create(:user, email: '[email protected]') | ||
end | ||
|
||
it 'redirects user to piv_recommended_path' do | ||
get :index | ||
|
||
expect(response).to redirect_to(login_piv_cac_recommended_url) | ||
end | ||
end | ||
end | ||
|
||
context 'with user having gov or mil email and use_fed_domain_class set to true' do | ||
before do | ||
allow(IdentityConfig.store).to receive(:use_fed_domain_class).and_return(true) | ||
end | ||
|
||
let!(:federal_domain) { create(:federal_email_domain, name: 'gsa.gov') } | ||
let(:user) do | ||
create(:user, email: '[email protected]', piv_cac_recommended_dismissed_at: Time.zone.now) | ||
end | ||
context 'having already visited the PIV interstitial page' do | ||
it 'tracks the visit in analytics' do | ||
get :index | ||
|
||
|
@@ -76,9 +44,7 @@ | |
end | ||
|
||
context 'directed to page without having visited PIV interstitial page' do | ||
let(:user) do | ||
create(:user, email: '[email protected]') | ||
end | ||
let(:interstitial_dismissed_at) { nil } | ||
|
||
it 'redirects user to piv_recommended_path' do | ||
get :index | ||
|
167 changes: 49 additions & 118 deletions
167
spec/features/sign_in/piv_recommended_after_sign_in_spec.rb
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 |
---|---|---|
@@ -1,132 +1,63 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature 'Piv recommended after Sign in' do | ||
context 'use_fed_domain_class set to true' do | ||
let!(:federal_email_domain) { create(:federal_email_domain, name: 'gsa.gov') } | ||
|
||
before do | ||
allow(IdentityConfig.store).to receive(:use_fed_domain_class).and_return(true) | ||
end | ||
|
||
scenario 'User with valid fed email directed to recommend page and get to setup piv' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
expect(page).to have_current_path(setup_piv_cac_path) | ||
end | ||
|
||
scenario 'User with mil email directed to recommended PIV page and goes to add piv page' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
expect(page).to have_current_path(setup_piv_cac_path) | ||
end | ||
|
||
scenario 'User with fed email and skips recommendation page' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
expect(page).to have_current_path(account_path) | ||
end | ||
|
||
scenario 'User with mil email and skips recommendation page' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
expect(page).to have_current_path(account_path) | ||
end | ||
|
||
scenario 'User with invalid .gov email directed to account page' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(account_path) | ||
end | ||
let!(:federal_email_domain) { create(:federal_email_domain, name: 'gsa.gov') } | ||
|
||
scenario 'User with valid fed email directed to recommend page and get to setup piv' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
expect(page).to have_current_path(setup_piv_cac_path) | ||
end | ||
|
||
context 'use_fed_domain_class set to false' do | ||
before do | ||
allow(IdentityConfig.store).to receive(:use_fed_domain_class).and_return(false) | ||
end | ||
scenario 'User with .gov email directed to recommend page and get to setup piv' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
expect(page).to have_current_path(setup_piv_cac_path) | ||
end | ||
scenario 'User with mil email directed to recommended PIV page and goes to add piv page' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
scenario 'User with .mil email directed to recommended PIV page and goes to add piv page' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
expect(page).to have_current_path(setup_piv_cac_path) | ||
end | ||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.add_piv')) | ||
expect(page).to have_current_path(setup_piv_cac_path) | ||
end | ||
|
||
scenario 'User with fed email and skips recommendation page' do | ||
user = create(:user, :with_phone, { email: 'example@example.gov' }) | ||
scenario 'User with fed email and skips recommendation page' do | ||
user = create(:user, :with_phone, { email: 'example@gsa.gov' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
expect(page).to have_current_path(account_path) | ||
end | ||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
expect(page).to have_current_path(account_path) | ||
end | ||
|
||
scenario 'User with mil email and skips recommendation page' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
scenario 'User with mil email and skips recommendation page' do | ||
user = create(:user, :with_phone, { email: '[email protected]' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
expect(page).to have_current_path(account_path) | ||
end | ||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(login_piv_cac_recommended_path) | ||
click_button(t('two_factor_authentication.piv_cac_upsell.skip')) | ||
expect(page).to have_current_path(account_path) | ||
end | ||
|
||
scenario 'User with invalid no .gov or .mil email directed to account page' do | ||
user = create(:user, :with_phone, { email: 'example@bad.com' }) | ||
scenario 'User with invalid .gov email directed to account page' do | ||
user = create(:user, :with_phone, { email: 'example@bad.gov' }) | ||
|
||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(account_path) | ||
end | ||
visit new_user_session_path | ||
fill_in_credentials_and_submit(user.email, user.password) | ||
fill_in_code_with_last_phone_otp | ||
click_submit_default | ||
expect(page).to have_current_path(account_path) | ||
end | ||
end |
Oops, something went wrong.