Sha256: affa2066b8e845058a208dbce8105448b28d0eecfdf1386adc4671a1546fcc9e

Contents?: true

Size: 1.88 KB

Versions: 3

Compression:

Stored size: 1.88 KB

Contents

require 'spec_helper'
require_relative '../newspaper_works/newspaper_core_presenter_spec'
require_relative '../newspaper_works/scanned_media_presenter_spec'

RSpec.describe Hyrax::NewspaperArticlePresenter do
  let(:solr_document) { SolrDocument.new(attributes) }
  let(:request) { double(host: 'example.org') }
  let(:ability) { nil }
  let(:presenter) { described_class.new(solr_document, ability, request) }

  let(:attributes) do
    { "author" => '888888',
      "photographer" => ['foo', 'bar'],
      "genre" => ["Editorials"],
      "volume" => ["volume 1"],
      "edition_number" => ["1"],
      "issue_number" => ['1'],
      "geographic_coverage" => ["wide"],
      "extent" => ["vast"],
      "publication_date" => ["2017-08-25"],
      'page_ids_ssim' => ['foo'],
      'page_titles_ssim' => ['bar'] }
  end

  it_behaves_like "a newspaper core presenter"
  it_behaves_like "a scanned media presenter"

  subject { described_class.new(double, double) }

  it { is_expected.to delegate_method(:author).to(:solr_document) }
  it { is_expected.to delegate_method(:photographer).to(:solr_document) }
  it { is_expected.to delegate_method(:genre).to(:solr_document) }
  it { is_expected.to delegate_method(:volume).to(:solr_document) }
  it { is_expected.to delegate_method(:edition_number).to(:solr_document) }
  it { is_expected.to delegate_method(:issue_number).to(:solr_document) }
  it { is_expected.to delegate_method(:geographic_coverage).to(:solr_document) }
  it { is_expected.to delegate_method(:extent).to(:solr_document) }
  it { is_expected.to respond_to(:publication_date) }

  describe 'object relationship methods' do
    describe '#page_ids' do
      it 'returns the correct value' do
        expect(presenter.page_ids).to eq ['foo']
      end
    end

    describe '#page_title' do
      it 'returns the correct value' do
        expect(presenter.page_titles).to eq ['bar']
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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