Skip to content

Commit

Permalink
Merge pull request #4355 from pulibrary/i3977_affiliates_can_request_…
Browse files Browse the repository at this point in the history
…on_order_and_in_process_items

Test alma affiliate users for in process and on order items
  • Loading branch information
christinach authored Sep 17, 2024
2 parents edb63f1 + be625d5 commit c06d0db
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/models/requests/service_eligibility/in_process_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,26 @@

expect(eligibility.eligible?).to be(false)
end

context 'with an alma authenticated user' do
let(:user) { FactoryBot.create(:guest_patron) }

it 'returns true' do
expect(user.guest?).to be false
expect(user.alma_provider?).to be(true)
expect(user.cas_provider?).to be(false)
expect(user.provider).to eq('alma')
requestable = instance_double(Requests::Requestable)
allow(requestable).to receive_messages(
aeon?: false,
charged?: false,
in_process?: true
)

eligibility = described_class.new(requestable:, user:)

expect(eligibility.eligible?).to be(true)
end
end
end
end
23 changes: 23 additions & 0 deletions spec/models/requests/service_eligibility/on_order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,28 @@

expect(eligibility.eligible?).to be(false)
end

context 'with an alma authenticated user' do
let(:user) { FactoryBot.create(:guest_patron) }

it 'returns true' do
expect(user.guest?).to be false
expect(user.alma_provider?).to be(true)
expect(user.cas_provider?).to be(false)
expect(user.provider).to eq('alma')
requestable = instance_double(Requests::Requestable)
allow(requestable).to receive_messages(
on_order?: true,
charged?: false,
in_process?: false,
alma_managed?: true,
aeon?: false
)

eligibility = described_class.new(requestable:, user:)

expect(eligibility.eligible?).to be(true)
end
end
end
end

0 comments on commit c06d0db

Please sign in to comment.