Sha256: 850c46b2af4820f651a81d1d213bfa03a497007a65cf1bfae92a6ec025ca71d1

Contents?: true

Size: 1.48 KB

Versions: 15

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

RSpec.describe GeoConcerns::ImageWorkShowPresenter do
  let(:solr_document) { SolrDocument.new(attributes) }
  let(:ability) { nil }

  subject { described_class.new(solr_document, ability) }

  describe "delegated methods" do
    let(:attributes)  { { "geo_mime_type_tesim" => ['image/tiff'] } }

    describe "#first" do
      it "delegates to solr document" do
        expect(subject.first('geo_mime_type_tesim')).to eq('image/tiff')
      end
    end

    describe "#has?" do
      it "delegates to solr document" do
        expect(subject.has?('geo_mime_type_tesim')).to be_truthy
      end
    end
  end

  describe "#work_presenters" do
    let(:obj) { FactoryGirl.create(:image_work_with_raster_works) }
    let(:attributes) { obj.to_solr }

    it "returns raster work presenters" do
      expect(subject.work_presenters.count).to eq 1
      expect(subject.work_presenters.first.first('has_model_ssim')).to eq "RasterWork"
    end
  end

  describe "file presenters" do
    let(:obj) { FactoryGirl.create(:image_work_with_files_and_metadata_files) }
    let(:attributes) { obj.to_solr }

    describe "#geo_file_set_presenters" do
      it "returns image file presenters" do
        expect(subject.geo_file_set_presenters.count).to eq 1
      end
    end

    describe "#external_metadata_file_set_presenters" do
      it "returns only external_metadata_file_set_presenters" do
        expect(subject.external_metadata_file_set_presenters.count).to eq 1
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.3.3 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.3.2 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.3.1 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.3.0 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.2.0 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.1.1 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.1.0 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.0.10 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.0.9 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.0.8 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.0.7 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.0.6 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.0.5 spec/presenters/image_work_show_presenter_spec.rb
geo_concerns-0.0.4 spec/presenters/image_work_show_presenter_spec.rb