Sha256: 4a7d0adaf99c86b271f8255b963a3f2246421754050781a02e6a85f5612fa5f7

Contents?: true

Size: 940 Bytes

Versions: 3

Compression:

Stored size: 940 Bytes

Contents

require 'spec_helper'

RSpec.describe NewspaperWorks::PersistentUrlPresenterBehavior do
  let(:request) { double(host: 'example.org') }
  let(:solr_document) { SolrDocument.new(id: 'abc123', lccn_tesim: ['sn1234567']) }

  describe '#persistent_url' do
    let(:presenter) { Hyrax::NewspaperArticlePresenter.new(solr_document, nil, request) }
    it 'returns nil' do
      expect(presenter.persistent_url).to eq nil
    end
  end

  describe '#persistent_url_attribute' do
    let(:presenter) { Hyrax::NewspaperTitlePresenter.new(solr_document, nil, request) }
    let(:purl_attribute) { presenter.persistent_url_attribute }
    subject { Nokogiri::HTML(purl_attribute) }
    it 'returns the HTML for the metadata display' do
      expect(subject.css('dd')).not_to be_blank
      expect(subject.css('li.attribute')).not_to be_blank
      expect(subject.css('a').attribute('href').value).to include '/newspapers/sn1234567'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newspaper_works-1.0.1 spec/presenters/newspaper_works/persistent_url_presenter_behavior_spec.rb
newspaper_works-1.0.0 spec/presenters/newspaper_works/persistent_url_presenter_behavior_spec.rb
newspaper_works-0.1.0 spec/presenters/newspaper_works/persistent_url_presenter_behavior_spec.rb