Skip to content

Commit

Permalink
Adjust tests to the removal of who.int from the lane proxy file
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jan 7, 2025
1 parent b68805e commit 66fdb6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions spec/models/concerns/index_links_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
context 'LANE records with a link_title/856$z restricted note' do
let(:document) do
SolrDocument.new(
marc_links_struct: [{ href: "https://who.int/whatever",
marc_links_struct: [{ href: "https://www.who.int/whatever",
fulltext: true,
stanford_only: true,
link_title: 'Access restricted to Stanford community' }],
Expand All @@ -160,20 +160,20 @@
end

it 'prefixes the link with the ezproxy URL' do
expect(document.index_links.all.first.href).to eq 'https://login.laneproxy.stanford.edu/login?qurl=https%3A%2F%2Fwho.int%2Fwhatever'
expect(document.index_links.all.first.href).to eq 'https://login.laneproxy.stanford.edu/login?qurl=https%3A%2F%2Fwww.who.int%2Fwhatever'
end
end

context 'LANE records without a link_title/856$z restricted note' do
let(:document) do
SolrDocument.new(
marc_links_struct: [{ href: "https://who.int/whatever", fulltext: true, stanford_only: true }],
marc_links_struct: [{ href: "https://www.who.int/whatever", fulltext: true, stanford_only: true }],
holdings_library_code_ssim: ['LANE']
)
end

it 'leaves the url alone' do
expect(document.index_links.all.first.href).to eq 'https://who.int/whatever'
expect(document.index_links.all.first.href).to eq 'https://www.who.int/whatever'
end
end

Expand Down Expand Up @@ -236,15 +236,15 @@
context 'a url that matches a LANE ezproxy host for a SUL item' do
let(:document) do
SolrDocument.new(
marc_links_struct: [{ href: "https://who.int/whatever",
marc_links_struct: [{ href: "https://www.who.int/whatever",
fulltext: true,
stanford_only: true,
link_title: 'Available to stanford-affiliated users.' }]
)
end

it 'leaves the url alone' do
expect(document.index_links.all.first.href).to eq 'https://who.int/whatever'
expect(document.index_links.all.first.href).to eq 'https://www.who.int/whatever'
end
end

Expand Down
8 changes: 4 additions & 4 deletions spec/models/links/ezproxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
end

context 'with a url matching a LANE proxied host' do
let(:url) { 'https://who.int/whatever' }
let(:url) { 'https://www.who.int/whatever' }
let(:link_title) { 'Access restricted to Stanford community' }

it { expect(ezproxy.to_proxied_url).to be_nil }
Expand Down Expand Up @@ -102,21 +102,21 @@
let(:document) { SolrDocument.new(holdings_library_code_ssim: ['LANE']) }

context 'with a url matching a LANE proxied host' do
let(:url) { 'https://who.int/whatever' }
let(:url) { 'https://www.who.int/whatever' }

context 'link title is a LANE restriction note' do
let(:link_title) { 'Access restricted to Stanford community' }

it 'adds the proxy prefix' do
expect(ezproxy.to_proxied_url).to eq 'https://login.laneproxy.stanford.edu/login?qurl=https%3A%2F%2Fwho.int%2Fwhatever'
expect(ezproxy.to_proxied_url).to eq 'https://login.laneproxy.stanford.edu/login?qurl=https%3A%2F%2Fwww.who.int%2Fwhatever'
end
end

context 'link title is a SUL restriction note' do
let(:link_title) { 'Available to Stanford-affiliated users only' }

it 'adds the proxy prefix' do
expect(ezproxy.to_proxied_url).to eq 'https://login.laneproxy.stanford.edu/login?qurl=https%3A%2F%2Fwho.int%2Fwhatever'
expect(ezproxy.to_proxied_url).to eq 'https://login.laneproxy.stanford.edu/login?qurl=https%3A%2F%2Fwww.who.int%2Fwhatever'
end
end

Expand Down

0 comments on commit 66fdb6d

Please sign in to comment.