Skip to content

Commit

Permalink
Summary Page: add link to accept lending policy for eligible patrons (#…
Browse files Browse the repository at this point in the history
…491)

For barred patrons who are eligible to opt into wage garnishment,
we now show a link in the "Alerts" section to the lending policy
so they can accept it and "unbar" their account.
  • Loading branch information
nicktiberi authored May 11, 2022
1 parent 3524cb5 commit 84e7d10
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/views/summaries/_summary.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<% unless patron.standing_human.blank? %>
<div class="page-section">
<h3>Alerts: </h3>
<div class="ml-4"><%= patron.standing_human %></div>
<div class="ml-4">
<p><%= patron.standing_human %></p>

<% if patron.eligible_for_wage_garnishment? %>
<p>
To unbar your account, please
<a href="<%= lending_policy_accept_path %>">accept the University Libraries lending policy</a>.
</p>
<% end %>
</div>
</div>
<% end %>

Expand Down
21 changes: 21 additions & 0 deletions spec/views/summaries/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
RSpec.describe 'summaries/index', type: :view do
let(:fines) { [build(:fine)] }
let(:patron_standing) { {} }
let(:eligible_for_wage_garnishment) { false }
let(:patron) do
instance_double(
Patron,
display_name: 'Test First Last',
checkouts: [],
holds: [],
fines: fines,
eligible_for_wage_garnishment?: eligible_for_wage_garnishment,
**patron_standing
)
end
Expand Down Expand Up @@ -49,6 +51,25 @@ def current_user?; end

expect(rendered).to have_css('h3', text: 'Alerts:')
end

context 'when the user is eligible for wage garnishment' do
let(:eligible_for_wage_garnishment) { true }

it 'shows a link to the accept lending policy page' do
render

expect(rendered).to have_link('accept the University Libraries lending policy',
href: lending_policy_accept_path)
end
end

context 'when the user is not eligible for wage garnishment' do
it 'does not show a link to the accept lending policy page' do
render

expect(rendered).not_to have_link('accept the University Libraries lending policy')
end
end
end

context 'when the patron does not have any checkouts, holds or bills' do
Expand Down

0 comments on commit 84e7d10

Please sign in to comment.