Skip to content

Commit

Permalink
Merge pull request #4279 from tulibraries/update-for-primo-api-changes
Browse files Browse the repository at this point in the history
Make updates for latest primo api changes.
  • Loading branch information
ebtoner committed Mar 7, 2024
2 parents 78c0cf5 + 9ff7031 commit b4a506d
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 55 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ GIT

GIT
remote: https://github.com/tulibraries/primo
revision: 171849ede7756b50dc3fa842ebfd4a9d95def88d
revision: 0f566fcc556ff0a4386fdce58ad498ecf585a9c7
branch: main
specs:
primo (0.2.0)
primo (0.3.0)
httparty

GIT
Expand Down
8 changes: 1 addition & 7 deletions app/models/blacklight/primo_central/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,13 @@ def libkey_articles_url_retracted?
}

def url(doc)
get_it(doc).fetch("link", "")
doc.dig("delivery", "almaOpenurl")
end

def link_label(doc)
I18n.t("primo_central.link_to_resource")
end

def get_it(doc = nil)
doc = (doc || @_source || {})
doc.dig("delivery", "GetIt1", 0, "links", 0) || {}
end


def url_query(url = @url)
query = (URI.parse(url).query rescue nil)
if (query)
Expand Down
2 changes: 1 addition & 1 deletion app/models/blacklight/primo_central/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def facet_segments(field, min, max, values)
first = boundaries[index]
last = boundaries[index + 1].to_i - 1
count = values.select { |f| f[:value] >= first && f[:value] <= last }
.map { |f| f[:count] }
.map { |f| f[:count].to_i }
.reduce(0, &:+)

segments << { from: first, to: last, count: count }
Expand Down
4 changes: 2 additions & 2 deletions config/initializers/primo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Primo.configure do |config|
config.apikey = ENV["PRIMO_API_KEY"] || Rails.configuration.bento&.dig(:primo, :apikey)
config.context = :PC
config.vid = "TULI"
config.scope = "pci_scope"
config.vid = "01TULI_INST:TULI"
config.scope = "CentralIndex"
config.enable_loggable = true
config.enable_log_requests = true
config.timeout = Rails.configuration.bento&.dig(:primo, :timeout) || 10
Expand Down
6 changes: 4 additions & 2 deletions spec/features/articles_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
expect(current_url).to eq "http://www.example.com/articles?search_field=any&q=foo"
expect(page).to have_css("#facets")
within(".document-position-0 h3") do
expect(page).to have_text("Test")
expect(page).to have_text("Otter")
end
within first(".document-metadata") do
expect(page).to have_text "Is Part Of:"
Expand Down Expand Up @@ -52,6 +52,8 @@
end

def default_articles_response_body
"{\"highlights\":{\"recordid\":[\"gvrl_refCX1959400467\"],\"creator\":[\"gvrl_refcx1959400467\"],\"contributor\":[\"gvrl_refcx1959400467\"],\"vertitle\":[\"gvrl_refcx1959400467\"],\"termsUnion\":[\"gvrl_refcx1959400467\"],\"title\":[\"gvrl_refcx1959400467\"]},\"docs\":[{\"enrichment\":{\"virtualBrowseObject\":{\"callNumber\":\"\",\"isVirtualBrowseEnabled\":false,\"callNumberBrowseField\":\"browse_callnumber\"}},\"delivery\":{\"availabilityLinks\":[\"detailsGetit1\"],\"physicalItemTextCodes\":\"\",\"displayLocation\":false,\"availabilityLinksUrl\":[\"\"],\"link\":[{\"displayLabel\":\"openurl\",\"inst4opac\":\"01TULI\",\"linkURL\":\"http://1.1.1.1?ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&ctx_tim=2019-02-08T12%3A37%3A26IST&url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-Article-gvrl_ref&rft_val_fmt=info:ofi/fmt:kev:mtx:journal&rft.genre=article&rft.atitle=Test&rft.jtitle=&rft.btitle=&rft.aulast=Apanasovich&rft.auinit=V.&rft.auinit1=&rft.auinitm=&rft.ausuffix=&rft.au=Apanasovich,%20Tatiyana%20V.&rft.aucorp=&rft.date=2010&rft.volume=&rft.issue=&rft.part=&rft.quarter=&rft.ssn=&rft.spage=1494&rft.epage=1495&rft.pages=1494-1495&rft.artnum=&rft.issn=&rft.eissn=&rft.isbn=978-1-4129-6128-8&rft.sici=&rft.coden=&rft_id=info:doi/&rft.object_id=&rft_dat=%3Cgvrl_ref%3ECX1959400467%3C/gvrl_ref%3E%3Cgrp_id%3E-8443850069020496193%3C/grp_id%3E%3Coa%3E%3C/oa%3E%3Curl%3E%3C/url%3E&rft.eisbn=&rft_id=info:oai/&rft_pqid=&rft_id=info:pmid/&rft_galeid=CX1959400467&rft_cupid=&rft_eruid=&rft_nurid=&rft_ingid=\",\"linkType\":\"http://purl.org/pnx/linkType/openurl\",\"@id\":\"_:0\"},{\"displayLabel\":\"openurlfulltext\",\"inst4opac\":\"01TULI\",\"linkURL\":\"http://1.1.1.1?ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&ctx_tim=2019-02-08T12%3A37%3A26IST&url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-Article-gvrl_ref&rft_val_fmt=info:ofi/fmt:kev:mtx:journal&rft.genre=article&rft.atitle=Test&rft.jtitle=&rft.btitle=&rft.aulast=Apanasovich&rft.auinit=V.&rft.auinit1=&rft.auinitm=&rft.ausuffix=&rft.au=Apanasovich,%20Tatiyana%20V.&rft.aucorp=&rft.date=2010&rft.volume=&rft.issue=&rft.part=&rft.quarter=&rft.ssn=&rft.spage=1494&rft.epage=1495&rft.pages=1494-1495&rft.artnum=&rft.issn=&rft.eissn=&rft.isbn=978-1-4129-6128-8&rft.sici=&rft.coden=&rft_id=info:doi/&rft.object_id=&svc_val_fmt=info:ofi/fmt:kev:mtx:sch_svc&svc.fulltext=yes&rft_dat=%3Cgvrl_ref%3ECX1959400467%3C/gvrl_ref%3E%3Cgrp_id%3E-8443850069020496193%3C/grp_id%3E%3Coa%3E%3C/oa%3E%3Curl%3E%3C/url%3E&rft.eisbn=&rft_id=info:oai/&rft_pqid=&rft_id=info:pmid/&rft_galeid=CX1959400467&rft_cupid=&rft_eruid=&rft_nurid=&rft_ingid=\",\"linkType\":\"http://purl.org/pnx/linkType/openurlfulltext\",\"@id\":\"_:1\"},{\"displayLabel\":\"thumbnail\",\"linkURL\":\"no_cover\",\"linkType\":\"http://purl.org/pnx/linkType/thumbnail\",\"@id\":\"_:2\"}],\"availability\":[\"fulltext\"],\"additionalLocations\":false,\"displayedAvailability\":\"fulltext\",\"holding\":[],\"deliveryCategory\":[\"Remote Search Resource\"],\"serviceMode\":[\"activate\"],\"feDisplayOtherLocations\":false,\"GetIt1\":[{\"links\":[{\"isLinktoOnline\":true,\"displayText\":\"Almaviewit_remote\",\"hyperlinkText\":\"\",\"getItTabText\":\"alma_tab1_full\",\"link\":\"https://temple.userservices.exlibrisgroup.com/view/uresolver/01TULI_INST/openurl?ctx_enc=info:ofi/enc:UTF-8&ctx_id=10_1&ctx_tim=2019-02-08T12%3A37%3A26IST&ctx_ver=Z39.88-2004&url_ctx_fmt=info:ofi/fmt:kev:mtx:ctx&url_ver=Z39.88-2004&rfr_id=info:sid/primo.exlibrisgroup.com-gvrl_ref&req_id=&rft_val_fmt=info:ofi/fmt:kev:mtx:journal&rft.genre=article&rft.atitle=Test&rft.jtitle=&rft.btitle=&rft.aulast=Apanasovich&rft.auinit=V.&rft.auinit1=&rft.auinitm=&rft.ausuffix=&rft.au=Apanasovich,%20Tatiyana%20V.&rft.aucorp=&rft.date=2010&rft.volume=&rft.issue=&rft.part=&rft.quarter=&rft.ssn=&rft.spage=1494&rft.epage=1495&rft.pages=1494-1495&rft.artnum=&rft.issn=&rft.eissn=&rft.isbn=978-1-4129-6128-8&rft.sici=&rft.coden=&rft_id=info:doi/&rft.object_id=&rft.eisbn=&rft.edition=&rft.pub=&rft.place=&rft.series=&rft.stitle=&rft.bici=&rft_id=info:bibcode/&rft_id=info:hdl/&rft_id=info:lccn/&rft_id=info:oclcnum/&rft_id=info:pmid/&rft_id=info:eric/((addata/eric}}&rft_dat=%3Cgvrl_ref%3ECX1959400467%3C/gvrl_ref%3E,language=eng,view=TULI&svc_dat=viewit&rft.local_attribute=&rft.kind=&rft_pqid=&rft_galeid=CX1959400467&rft_cupid=&rft_eruid=&rft_nurid=&rft_ingid=\",\"@id\":\"_:0\"}],\"category\":\"Remote Search Resource\"}]},\"context\":\"PC\",\"adaptor\":\"primo_central_multiple_fe\",\"pnx\":{\"delivery\":{\"fulltext\":[\"fulltext\"],\"delcategory\":[\"Remote Search Resource\"]},\"search\":{\"sourceid\":[\"gvrl_ref\"],\"lsr40\":[\"2010, pp.1494-1495\"],\"creatorcontrib\":[\"Apanasovich, Tatiyana V.\"],\"creationdate\":[\"2010\"],\"citation\":[\"pf 1494 pt 1495\"],\"isbn\":[\"978-1-4129-6128-8\",\"9781412961288\"],\"rsrctype\":[\"reference_entry\"],\"title\":[\"Test\"],\"startdate\":[\"20100101\"],\"recordid\":[\"gvrl_refCX1959400467\"],\"general\":[\"English\",\"Gale Virtual Reference Library (GVRL)\"],\"enddate\":[\"20101231\"],\"alttitle\":[\"Encyclopedia of Research Design\"],\"scope\":[\"gvrl_ref\",\"gale_gvrl\"]},\"display\":{\"identifier\":[\"<b>ISBN: </b>978-1-4129-6128-8\"],\"creator\":[\"Apanasovich, Tatiyana V.\"],\"ispartof\":[\"Encyclopedia of Research Design\"],\"language\":[\"eng\"],\"source\":[\"Gale Virtual Reference Library (GVRL)\"],\"title\":[\"Test\"],\"type\":[\"reference_entry\"]},\"links\":{\"openurl\":[\"$$Topenurl_article\"],\"openurlfulltext\":[\"$$Topenurlfull_article\"]},\"control\":{\"recordid\":[\"TN_gvrl_refCX1959400467\"],\"sourceid\":[\"gvrl_ref\"],\"galeid\":[\"CX1959400467\"],\"sourcerecordid\":[\"CX1959400467\"],\"sourcesystem\":[\"Other\"]},\"addata\":{\"date\":[\"2010\"],\"aulast\":[\"Apanasovich\"],\"isbn\":[\"978-1-4129-6128-8\"],\"format\":[\"journal\"],\"ristype\":[\"GEN\"],\"spage\":[\"1494\"],\"auinit\":[\"V.\"],\"atitle\":[\"Test\"],\"aufirst\":[\"Tatiyana\"],\"pages\":[\"1494-1495\"],\"au\":[\"Apanasovich, Tatiyana V.\"],\"epage\":[\"1495\"],\"genre\":[\"article\"],\"risdate\":[\"2010\"]},\"sort\":{\"creationdate\":[\"20100000\"],\"author\":[\"Apanasovich, Tatiyana V.\"],\"title\":[\"Test\"],\"lso01\":[\"20100000\"]},\"facets\":{\"frbrtype\":[\"6\"],\"creatorcontrib\":[\"Apanasovich, Tatiyana V.\"],\"creationdate\":[\"2010\"],\"frbrgroupid\":[\"-8443850069020496193\"],\"rsrctype\":[\"reference_entrys\"],\"language\":[\"eng\"],\"collection\":[\"Gale Virtual Reference Library (GVRL)\"],\"prefilter\":[\"reference_entrys\"]}},\"@id\":\"http://temple-primo.hosted.exlibrisgroup.com/primo_library/libweb/webservices/rest/primo-explore/v1/pnxs/PC/TN_gvrl_refCX1959400467\"}],\"timelog\":{\"BriefSearchDeltaTime\":366,\"DoSearchPrimoResultDeltaTime\":339,\"StartBriefSearch\":1549651046219,\"retrieveHighLightsDeltaTime\":27,\"retrieveDidUMeanDeltaTime\":27,\"GetSearchStatusDeltaTime\":339,\"StartTranslationTime\":1549651046558,\"AddSearchStatusDeltaTime\":0,\"FullEndDMDataDeltaTime\":27,\"retrieveFacetsDeltaTime\":27},\"lang3\":\"eng\",\"info\":{\"total\":1,\"last\":\"1\",\"maxTotal\":0,\"first\":\"1\"},\"facets\":[{\"values\":[{\"count\":1,\"value\":\"Apanasovich, Tatiyana V.\"}],\"name\":\"creator\"},{\"values\":[{\"count\":1,\"value\":\"eng\"}],\"name\":\"lang\"},{\"values\":[{\"count\":1,\"value\":\"reference_entrys\"}],\"name\":\"rtype\"},{\"values\":[{\"count\":1,\"value\":\"online_resources\"}],\"name\":\"tlevel\"},{\"values\":[{\"count\":1,\"value\":\"reference_entrys\"}],\"name\":\"pfilter\"},{\"values\":[{\"count\":1,\"value\":\"2010\"}],\"name\":\"creationdate\"},{\"values\":[{\"count\":1,\"value\":\"Gale Virtual Reference Library (GVRL)\"}],\"name\":\"domain\"}],\"beaconO22\":\"383\"}"
File.open("spec/fixtures/articles_search_response.json", "r") do |file|
file.read
end
end
end
1 change: 1 addition & 0 deletions spec/fixtures/articles_search_response.json

Large diffs are not rendered by default.

77 changes: 37 additions & 40 deletions spec/models/primo_central_document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

RSpec.describe PrimoCentralDocument, type: :model do
let (:config) { PrimoCentralController.new.blacklight_config }
let(:doc) { { "pnxId" => "foobar" } }
let (:subject) { PrimoCentralDocument.new(doc, blacklight_config: config) }
let(:docs) { { "pnxId" => "foobar" } }
let (:subject) { PrimoCentralDocument.new(docs, blacklight_config: config) }

it "is configurable" do
expect(config).to_not be_nil
Expand All @@ -20,30 +20,30 @@
end

context "a pnxs object is loaded" do
let(:doc) { { "pnxId" => "TN_fizzfuzz" } }
let(:docs) { { "pnxId" => "TN_fizzfuzz" } }
it "removes TN_ from beginning of id" do
expect(subject.id).to eq("fizzfuzz")
end
end

context "with pnx description " do
let(:doc) { { "pnx" => { "search" => { "description" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "search" => { "description" => [ "foo" ] } } } }

it "maps the description" do
expect(subject["description"]).to eq("foo")
end
end

context "with pnx subject" do
let(:doc) { { "pnx" => { "search" => { "subject" => [ "foo", "bar"] } } } }
let(:docs) { { "pnx" => { "search" => { "subject" => [ "foo", "bar"] } } } }

it "maps the subject" do
expect(subject["subject"]).to eq([ "foo", "bar" ])
end
end

context "with pnx type" do
let(:doc) { { "pnx" => { "display" => { "type" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "display" => { "type" => [ "foo" ] } } } }

it "maps the type and format" do
expect(subject["type"]).to eq([ "foo" ])
Expand All @@ -52,112 +52,112 @@
end

context "with pnx title" do
let(:doc) { { "pnx" => { "display" => { "title" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "display" => { "title" => [ "foo" ] } } } }

it "maps the title" do
expect(subject["title"]).to eq("foo")
end
end

context "with pnx contributor" do
let(:doc) { { "pnx" => { "display" => { "contributor" => [ "foo;bar" ] } } } }
let(:docs) { { "pnx" => { "display" => { "contributor" => [ "foo;bar" ] } } } }

it "maps the contributor" do
expect(subject["contributor"]).to eq(["foo", "bar"])
end
end

context "with pnx dislpay publisher" do
let(:doc) { { "pnx" => { "display" => { "publisher" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "display" => { "publisher" => [ "foo" ] } } } }
it "maps the publisher" do
expect(subject["publisher"]).to eq(["foo"])
end
end

context "with pnx addata pub" do
let(:doc) { { "pnx" => { "addata" => { "pub" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "addata" => { "pub" => [ "foo" ] } } } }
it "maps the publisher" do
expect(subject["publisher"]).to eq(["foo"])
end
end

context "with pnx display relation" do
let(:doc) { { "pnx" => { "display" => { "relation" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "display" => { "relation" => [ "foo" ] } } } }
it "maps the relation" do
expect(subject["relation"]).to eq(["foo"])
end
end

context "with pnx search isbn" do
let(:doc) { { "pnx" => { "search" => { "isbn" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "search" => { "isbn" => [ "foo" ] } } } }
it "maps isbn" do
expect(subject["isbn"]).to eq(["foo"])
end
end

context "with pnx addata lccn" do
let(:doc) { { "pnx" => { "addata" => { "lccn" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "addata" => { "lccn" => [ "foo" ] } } } }
it "maps lccn" do
expect(subject["lccn"]).to eq(["foo"])
end
end

context "with pnx search issn" do
let(:doc) { { "pnx" => { "search" => { "issn" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "search" => { "issn" => [ "foo" ] } } } }
it "maps issn" do
expect(subject["issn"]).to eq(["foo"])
end
end

context "with pnx display ispartof" do
let(:doc) { { "pnx" => { "display" => { "ispartof" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "display" => { "ispartof" => [ "foo" ] } } } }
it "maps isPartOf" do
expect(subject["isPartOf"]).to eq("foo")
end
end

context "with pnx search creatorcontrib" do
let(:doc) { { "pnx" => { "search" => { "creatorcontrib" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "search" => { "creatorcontrib" => [ "foo" ] } } } }

it "maps creator" do
expect(subject["creator"]).to eq(["foo"])
end
end

context "with pnx search creationdate" do
let(:doc) { { "pnx" => { "search" => { "creationdate" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "search" => { "creationdate" => [ "foo" ] } } } }

it "maps date" do
expect(subject["date"]).to eq(["foo"])
end
end

context "with pnx addata doi" do
let(:doc) { { "pnx" => { "addata" => { "doi" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "addata" => { "doi" => [ "foo" ] } } } }

it "maps doi" do
expect(subject["doi"]).to eq(["foo"])
end
end

context "with pnx search language " do
let(:doc) { { "pnx" => { "search" => { "language" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "search" => { "language" => [ "foo" ] } } } }

it "maps language" do
expect(subject["language"]).to eq(["foo"])
end
end

context "with pnx display language " do
let(:doc) { { "pnx" => { "display" => { "language" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "display" => { "language" => [ "foo" ] } } } }

it "maps language" do
expect(subject["language"]).to eq(["foo"])
end
end

context "with lang3" do
let(:doc) { { "lang3" => "foo" } }
let(:docs) { { "lang3" => "foo" } }

it "maps language" do
expect(subject["language"]).to eq(["foo"])
Expand All @@ -166,15 +166,15 @@

describe "#has_direct_link?" do
context "document is completely empty" do
let(:doc) { Hash.new }
let(:docs) { Hash.new }

it "verifies there is no direct_link" do
expect(subject.has_direct_link?).to be(false)
end
end

context "document has a direct_link" do
let(:doc) { ActiveSupport::HashWithIndifferentAccess.new(
let(:docs) { ActiveSupport::HashWithIndifferentAccess.new(
delivery: { availability: ["fulltext_linktorsrc"] }
)}

Expand All @@ -184,7 +184,7 @@
end

context "document does not have a direct link" do
let(:doc) { ActiveSupport::HashWithIndifferentAccess.new(
let(:docs) { ActiveSupport::HashWithIndifferentAccess.new(
delivery: { availability: ["foobar"] }
)}

Expand All @@ -207,33 +207,30 @@
end

context "document direct_link contains rft.isbn = ''" do
let(:doc) { ActiveSupport::HashWithIndifferentAccess.new(
let(:docs) { ActiveSupport::HashWithIndifferentAccess.new(
delivery: {
GetIt1: [{
"links" => [{ "link" => "http://foobar.com?rft.isbn=" }],
}] }) }
"almaOpenurl": "http://foobar.com?rft.isbn="
}) }
it "sets @doc['isbn'] to nil" do
expect(subject["isbn"]).to be_nil
end
end

context "document direc_link contains a regular value" do
let(:doc) { ActiveSupport::HashWithIndifferentAccess.new(
let(:docs) { ActiveSupport::HashWithIndifferentAccess.new(
delivery: {
GetIt1: [{
"links" => [{ "link" => "http://foobar.com?rft.isbn=a" }],
}] }) }
"almaOpenurl": "http://foobar.com?rft.isbn=a"
}) }
it "sets @doc['isbn'] to [a]" do
expect(subject["isbn"]).to eq(["a"])
end
end

context "document direct_link is proxied and isbn=foo" do
let(:doc) { ActiveSupport::HashWithIndifferentAccess.new(
let(:docs) { ActiveSupport::HashWithIndifferentAccess.new(
delivery: {
GetIt1: [{
"links" => [{ "link" => "http://myproxy.edu?url=http://foobar.com?rft.isbn=foo" }],
}] }) }
"almaOpenurl": "http://myproxy.edu?url=http://foobar.com?rft.isbn=foo"
}) }
it "sets @doc['isbn'] to foo" do
expect(subject["isbn"]).to eq(["foo"])
end
Expand Down Expand Up @@ -286,7 +283,7 @@

describe "libkey_articles_url" do
context "doi not present" do
let(:doc) { {} }
let(:docs) { {} }

it "returns a nil" do
expect(subject.libkey_articles_url).to be_nil
Expand All @@ -295,7 +292,7 @@
end

context "fullTextFile present" do
let(:doc) { { "pnx" => { "addata" => { "doi" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "addata" => { "doi" => [ "foo" ] } } } }

it "returns the fullTextFile URL string" do
stub_request(:get, /articles/)
Expand All @@ -312,7 +309,7 @@
end

context "contentLocation present" do
let(:doc) { { "pnx" => { "addata" => { "doi" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "addata" => { "doi" => [ "foo" ] } } } }

it "returns the contentLocation URL string" do
stub_request(:get, /articles/)
Expand All @@ -326,7 +323,7 @@
end

context "retractionNoticeUrl present" do
let(:doc) { { "pnx" => { "addata" => { "doi" => [ "foo" ] } } } }
let(:docs) { { "pnx" => { "addata" => { "doi" => [ "foo" ] } } } }

it "returns the fullTextFile URL string" do
stub_request(:get, /articles/)
Expand Down
4 changes: 3 additions & 1 deletion spec/views/primo_central/_button_online.html.erb._spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

RSpec.describe "primo_central/_button_online.html.erb", type: :view do
it "adds the expected parameter to the iframe source link" do
view.instance_variable_set("@document", PrimoCentralDocument.new("link" => "", "pnxId" => ""))
view.instance_variable_set("@document", PrimoCentralDocument.new({
"pnxId" => "",
"delivery" => { "almaOpenurl" => "https://helloworld" } }))
expect(view.render("online_button")).to match(/is_new_ui=true/)
end
end

0 comments on commit b4a506d

Please sign in to comment.