-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LG-14587 | Updates to 'You successfully verified your identity' email (…
…#11295) changelog: User-Facing Improvements, Account verified email, Prompt user to return to SP
- Loading branch information
1 parent
d6add6f
commit a2dbea2
Showing
12 changed files
with
296 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
module Idv | ||
class AccountVerifiedEmailPresenter | ||
include Rails.application.routes.url_helpers | ||
|
||
attr_reader :profile | ||
|
||
def initialize(profile:) | ||
@profile = profile | ||
end | ||
|
||
def service_provider | ||
profile.initiating_service_provider | ||
end | ||
|
||
def show_cta? | ||
!service_provider || service_provider_homepage_url.present? | ||
end | ||
|
||
def sign_in_url | ||
service_provider_homepage_url || root_url | ||
end | ||
|
||
def service_provider_homepage_url | ||
sp_return_url_resolver.homepage_url if service_provider | ||
end | ||
|
||
def sp_name | ||
service_provider&.friendly_name || APP_NAME | ||
end | ||
|
||
def url_options | ||
{} | ||
end | ||
|
||
private | ||
|
||
def sp_return_url_resolver | ||
SpReturnUrlResolver.new(service_provider: service_provider) | ||
end | ||
end | ||
end |
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
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
96 changes: 96 additions & 0 deletions
96
spec/presenters/idv/account_verified_email_presenter_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 |
---|---|---|
@@ -0,0 +1,96 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Idv::AccountVerifiedEmailPresenter do | ||
include Rails.application.routes.url_helpers | ||
|
||
let(:service_provider) { create(:service_provider) } | ||
|
||
let(:profile) do | ||
create( | ||
:profile, | ||
initiating_service_provider: service_provider, | ||
) | ||
end | ||
|
||
subject(:presenter) { described_class.new(profile:) } | ||
|
||
context 'when there is no associated service provider' do | ||
let(:service_provider) { nil } | ||
|
||
describe '#show_cta?' do | ||
it 'is true' do | ||
expect(presenter.show_cta?).to eq(true) | ||
end | ||
end | ||
|
||
describe '#sp_name' do | ||
it 'returns our APP_NAME instead' do | ||
expect(presenter.sp_name).to eq(APP_NAME) | ||
end | ||
end | ||
|
||
describe '#sign_in_url' do | ||
it 'links to ourselves since there is no SP' do | ||
expect(presenter.sign_in_url).to eq(root_url) | ||
end | ||
end | ||
end | ||
|
||
context 'where there is a service provider' do | ||
context 'when the service provider has no return URL' do | ||
let(:service_provider) do | ||
create( | ||
:service_provider, | ||
return_to_sp_url: nil, | ||
friendly_name: 'My Awesome SP', | ||
) | ||
end | ||
|
||
describe '#show_cta?' do | ||
it 'is false' do | ||
expect(presenter.show_cta?).to eq(false) | ||
end | ||
end | ||
|
||
describe '#sp_name' do | ||
it 'returns the SP name' do | ||
expect(presenter.sp_name).to eq('My Awesome SP') | ||
end | ||
end | ||
|
||
describe '#sign_in_url' do | ||
it 'links to ourselves' do | ||
expect(presenter.sign_in_url).to eq(root_url) | ||
end | ||
end | ||
end | ||
|
||
context 'when the service provider does have a return URL' do | ||
let(:service_provider) do | ||
create( | ||
:service_provider, | ||
return_to_sp_url: 'https://www.example.com', | ||
friendly_name: 'My Awesome SP', | ||
) | ||
end | ||
|
||
describe '#show_cta?' do | ||
it 'is true' do | ||
expect(presenter.show_cta?).to eq(true) | ||
end | ||
end | ||
|
||
describe '#sp_name' do | ||
it 'shows the SP name' do | ||
expect(presenter.sp_name).to eq('My Awesome SP') | ||
end | ||
end | ||
|
||
describe '#sign_in_url' do | ||
it 'links to the SP' do | ||
expect(presenter.sign_in_url).to eq('https://www.example.com') | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.