diff --git a/Gemfile.lock b/Gemfile.lock index 3f61738f2..408b7ba44 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,8 +89,6 @@ GEM base64 (0.2.0) bcrypt (3.1.20) bcrypt_pbkdf (1.1.1) - bcrypt_pbkdf (1.1.1-arm64-darwin) - bcrypt_pbkdf (1.1.1-x86_64-darwin) benchmark (0.4.0) bibtex-ruby (6.1.0) latex-decode (~> 0.0) diff --git a/app/components/record/item/embed_component.rb b/app/components/record/item/embed_component.rb new file mode 100644 index 000000000..f7a60f240 --- /dev/null +++ b/app/components/record/item/embed_component.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Record + module Item + class EmbedComponent < ViewComponent::Base + def initialize(druid:) + @druid = druid + super + end + + attr_reader :druid + + def call + tag.div(data: { behavior: "purl-embed", embed_url: }) + end + + def embed_url + "#{Settings.PURL_EMBED_PROVIDER}.json?hide_title=true&url=#{Settings.PURL_EMBED_RESOURCE}#{druid}" + end + end + end +end diff --git a/app/components/record/item/marc/metadata_component.html.erb b/app/components/record/item/marc/metadata_component.html.erb index e0fbc755c..e3dcddb10 100644 --- a/app/components/record/item/marc/metadata_component.html.erb +++ b/app/components/record/item/marc/metadata_component.html.erb @@ -16,7 +16,7 @@
diff --git a/app/components/record/item/mods/metadata_component.html.erb b/app/components/record/item/mods/metadata_component.html.erb index 924a16e71..fb4d24614 100644 --- a/app/components/record/item/mods/metadata_component.html.erb +++ b/app/components/record/item/mods/metadata_component.html.erb @@ -5,7 +5,7 @@ <% if document.druid && document.published_content? %>stuff
") - end - - it "should return correct response" do - get :show, params: { format: "json", id: "abc123" } - expect(response).to have_http_status :ok - end - end -end diff --git a/spec/features/blacklight_customizations/librarian_view_spec.rb b/spec/features/blacklight_customizations/librarian_view_spec.rb index bc4d84e1e..d67849a5c 100644 --- a/spec/features/blacklight_customizations/librarian_view_spec.rb +++ b/spec/features/blacklight_customizations/librarian_view_spec.rb @@ -3,8 +3,6 @@ require 'rails_helper' RSpec.describe "Librarian View Customization", :js do - let(:embed) { double('embed-response') } - it "MARC records should display" do visit solr_document_path('28') @@ -23,8 +21,6 @@ end it "MODS records should display" do - expect(embed).to receive(:html).and_return("") - expect(PURLEmbed).to receive(:new).and_return(embed) visit solr_document_path('35') within(".tech-details") do diff --git a/spec/lib/purl_embed_spec.rb b/spec/lib/purl_embed_spec.rb deleted file mode 100644 index e0a4ba1db..000000000 --- a/spec/lib/purl_embed_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe PURLEmbed do - let(:druid) { 'abc123' } - let(:provider) { double('provider') } - - before do - expect(provider).to receive(:<<).with(Settings.PURL_EMBED_URL_SCHEME) - end - - describe 'provider' do - let(:resource) { double('resource') } - - before do - allow_any_instance_of(PURLEmbed).to receive(:provider).and_return(provider) - end - - describe 'URL Scheme' do - it 'should set the PURL Embed URL scheme in the settings when instantiated' do - PURLEmbed.new(druid) # expectation in before block - end - end - - describe 'resource' do - before do - expect(resource).to receive(:html).and_return('