Sha256: d7a525506b317a61a4a549cb3165840c453fed4bbe93b0d79409add9f3920a1a
Contents?: true
Size: 1.95 KB
Versions: 27
Compression:
Stored size: 1.95 KB
Contents
require 'spec_helper' describe CurationConcerns::FileSetPresenter do let(:solr_document) { SolrDocument.new("title_tesim" => ["foo bar"], "human_readable_type_tesim" => ["File Set"], "mime_type_ssi" => 'image/jpeg', "has_model_ssim" => ["FileSet"]) } let(:ability) { nil } let(:presenter) { described_class.new(solr_document, ability) } describe "#to_s" do subject { presenter.to_s } it { is_expected.to eq 'foo bar' } end describe "#human_readable_type" do subject { presenter.human_readable_type } it { is_expected.to eq 'File Set' } end describe "#model_name" do subject { presenter.model_name } it { is_expected.to be_kind_of ActiveModel::Name } end describe "#to_partial_path" do subject { presenter.to_partial_path } it { is_expected.to eq 'file_sets/file_set' } end describe "office_document?" do subject { presenter.office_document? } it { is_expected.to be false } end describe "has?" do subject { presenter.has?('thumbnail_path_ss') } it { is_expected.to be false } end describe "first" do subject { presenter.first('human_readable_type_tesim') } it { is_expected.to eq 'File Set' } end describe "properties delegated to solr_document" do let(:solr_properties) do ["date_uploaded", "depositor", "tags", "title_or_label", "contributor", "creator", "title", "description", "publisher", "subject", "language", "rights"] end it "delegates to the solr_document" do solr_properties.each do |property| expect(solr_document).to receive(property.to_sym) presenter.send(property) end end end describe "fetch" do it "delegates to the solr_document" do expect(solr_document).to receive(:fetch).and_call_original expect(presenter.fetch("has_model_ssim")).to eq ["FileSet"] end end end
Version data entries
27 entries across 27 versions & 1 rubygems