Sha256: 6b168ede70581083a2728a92b321964481aefcb2ab0003337e22e47f86f30699

Contents?: true

Size: 1.48 KB

Versions: 6

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

RSpec.describe GeoWorks::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

6 entries across 6 versions & 1 rubygems

Version Path
geo_works-0.2.0 spec/presenters/image_work_show_presenter_spec.rb
geo_works-0.1.4 spec/presenters/image_work_show_presenter_spec.rb
geo_works-0.1.3 spec/presenters/image_work_show_presenter_spec.rb
geo_works-0.1.2 spec/presenters/image_work_show_presenter_spec.rb
geo_works-0.1.1 spec/presenters/image_work_show_presenter_spec.rb
geo_works-0.1.0 spec/presenters/image_work_show_presenter_spec.rb