Sha256: 901d92025c2a22c721b51c571c8dbb30327873d2ee753b8ea79a250040826df4

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

RSpec.describe NewspaperWorks::IiifManifestPresenterBehavior do
  let(:attributes) do
    { "id" => "abc123",
      "title_tesim" => ['Page the first'],
      "page_number_tesim" => ['20'],
      "section_tesim" => ['B'] }
  end
  let(:solr_document) { SolrDocument.new(attributes) }
  let(:presenter) { Hyrax::NewspaperPagePresenter.new(solr_document, nil) }
  let(:test_request) { ActionDispatch::TestRequest.new({}) }

  before { allow(presenter).to receive(:request).and_return(test_request) }

  describe '#search_service' do
    it 'returns the correct URL for the IIIF Search service' do
      expect(presenter.search_service).to include('abc123/iiif_search')
    end
  end

  describe '#manifest_metadata' do
    subject { presenter.manifest_metadata }

    it { is_expected.not_to be_falsey }

    it 'returns the correct metadata array for the manifest' do
      expect(subject.map { |v| v["label"] }).to include('Page number')
      expect(subject.map { |v| v["value"] }).to include(['B'])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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