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
2 changes: 1 addition & 1 deletion app/views/accounts/_phone.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.right-align.col.col-6
- if MfaContext.new(current_user).phone_configurations.empty?
.btn.btn-account-action.rounded-lg.bg-light-blue
= link_to t('account.index.phone_add'), path: manage_phone_url
= link_to t('account.index.phone_add'), manage_phone_path
- MfaContext.new(current_user).phone_configurations.each do |phone_configuration|
.p2.col.col-12.border-top.border-blue-light
.col.col-8.sm-6.truncate
Expand Down
43 changes: 43 additions & 0 deletions spec/views/accounts/show.html.slim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,47 @@

expect(view).to render_template(partial: '_delete_account_item_heading')
end

context 'phone listing and adding' do
it 'renders the phone section' do
render

expect(view).to render_template(partial: '_phone')
end

context 'user has no phone' do
let(:user) do
record = build_stubbed(:user, :signed_up, :with_piv_or_cac)
record.phone_configurations = []
record
end

it 'shows the add phone link' do
render

expect(rendered).to have_link(
t('account.index.phone_add'), href: manage_phone_path
)
end
end

context 'user has a phone' do
it 'shows no add phone link' do
render

expect(rendered).to_not have_content t('account.index.phone_add')
expect(rendered).to_not have_link(
t('account.index.phone_add'), href: manage_phone_path
)
end

it 'shows an edit link' do
render

expect(rendered).to have_link(
t('account.index.phone'), href: manage_phone_url
)
end
end
end
end