From 9fcd2a52368bf02fd906088aac3607591f07dba6 Mon Sep 17 00:00:00 2001 From: Monique Rio Date: Mon, 17 Oct 2022 10:43:46 -0400 Subject: [PATCH] fix: changes illiad renew to a direction instead of a link --- .irbrc | 2 +- .../interlibrary_loan/interlibrary_loan_item.rb | 8 ++++++-- .../interlibrary_loan_item_spec.rb | 14 +++++++++----- views/current-checkouts/interlibrary-loan.erb | 8 ++------ .../scans-and-electronic-items.erb | 8 ++------ 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.irbrc b/.irbrc index 98f4e8d5..d8afb3da 100644 --- a/.irbrc +++ b/.irbrc @@ -1 +1 @@ -require_relative "my_account" +require_relative "account" diff --git a/models/items/interlibrary_loan/interlibrary_loan_item.rb b/models/items/interlibrary_loan/interlibrary_loan_item.rb index 2dd07019..af39483c 100644 --- a/models/items/interlibrary_loan/interlibrary_loan_item.rb +++ b/models/items/interlibrary_loan/interlibrary_loan_item.rb @@ -32,8 +32,12 @@ def url_cancel_request illiad_url(21, 10, true) end - def url_request_renewal - illiad_url(10, 72) + def renew_text + if renewable? + "Yes - select title to request renewal" + else + "No - not eligible for renewal" + end end def creation_date diff --git a/spec/models/items/interlibrary_loan/interlibrary_loan_item_spec.rb b/spec/models/items/interlibrary_loan/interlibrary_loan_item_spec.rb index 701c85fd..b3dbef58 100644 --- a/spec/models/items/interlibrary_loan/interlibrary_loan_item_spec.rb +++ b/spec/models/items/interlibrary_loan/interlibrary_loan_item_spec.rb @@ -38,11 +38,6 @@ expect(subject.url_cancel_request).to eq("https://ill.lib.umich.edu/illiad/illiad.dll?Action=21&Type=10&Value=3298020") end end - context "#url_request_renewal" do - it "returns url to the form to request a renewal of the ILLiad transaction" do - expect(subject.url_request_renewal).to eq("https://ill.lib.umich.edu/illiad/illiad.dll?Action=10&Form=72&Value=3298020") - end - end context "#creation_date" do it "returns creation date string" do expect(subject.creation_date).to eq("03/09/21") @@ -77,6 +72,15 @@ expect(subject.transaction_date).to eq("03/09/21") end end + context "#renew_text" do + it "returns correct text when renewable" do + @item["RenewalsAllowed"] = true + expect(subject.renew_text).to eq("Yes - select title to request renewal") + end + it "returns correct text when not_renewable" do + expect(subject.renew_text).to eq("No - not eligible for renewal") + end + end context "#renewable?" do it "returns a boolean" do expect(subject.renewable?).to eq(false) diff --git a/views/current-checkouts/interlibrary-loan.erb b/views/current-checkouts/interlibrary-loan.erb index 1b9e120a..670839e0 100644 --- a/views/current-checkouts/interlibrary-loan.erb +++ b/views/current-checkouts/interlibrary-loan.erb @@ -15,7 +15,7 @@ Title & author Due date - Action + Eligible for renewal @@ -34,11 +34,7 @@ <% end %> - <% if interlibrary_loan.renewable? %> - Request Renewal - <% else %> -

Not eligible for renewal

- <% end %> + <%= interlibrary_loan.renew_text %> <% end %> diff --git a/views/current-checkouts/scans-and-electronic-items.erb b/views/current-checkouts/scans-and-electronic-items.erb index 47ba9315..de6ef9f7 100644 --- a/views/current-checkouts/scans-and-electronic-items.erb +++ b/views/current-checkouts/scans-and-electronic-items.erb @@ -15,7 +15,7 @@ Title & author Expires - Action + Eligible for renewal @@ -30,11 +30,7 @@ <%= delivery.expiration_date %> - <% if delivery.renewable? %> - Request Renewal - <% else %> -

Not eligible for renewal

- <% end %> + <%= interlibrary_loan.renew_text %> <% end %>