Sha256: 893d434ecad2a42d5ba29e9f2a03d0373017c4fb697eda945fd31261d59e7df7

Contents?: true

Size: 1.91 KB

Versions: 48

Compression:

Stored size: 1.91 KB

Contents

require 'spec_helper'

describe SolrDocument do
  let(:document) { described_class.new(attributes) }

  describe "date_uploaded" do
    let(:attributes) { { 'date_uploaded_dtsi' => "2015-08-31T00:00:00Z" } }
    subject { document.date_uploaded }

    it { is_expected.to eq '08/31/2015' }
  end

  describe "representative_id" do
    let(:attributes) { { Solrizer.solr_name('hasRelatedMediaFragment', :symbol) => ['one'] } }
    subject { document.representative_id }
    it { is_expected.to eq 'one' }
  end

  describe "creator" do
    let(:attributes) { { Solrizer.solr_name('creator') => ['one', 'two'] } }
    subject { document.creator }
    it { is_expected.to eq ['one', 'two'] }
  end

  describe "contributor" do
    let(:attributes) { { Solrizer.solr_name('contributor') => ['one', 'two'] } }
    subject { document.contributor }
    it { is_expected.to eq ['one', 'two'] }
  end

  describe "subject" do
    let(:attributes) { { Solrizer.solr_name('subject') => ['one', 'two'] } }
    subject { document.subject }
    it { is_expected.to eq ['one', 'two'] }
  end

  describe "publisher" do
    let(:attributes) { { Solrizer.solr_name('publisher') => ['one', 'two'] } }
    subject { document.publisher }
    it { is_expected.to eq ['one', 'two'] }
  end

  describe "language" do
    let(:attributes) { { Solrizer.solr_name('language') => ['one', 'two'] } }
    subject { document.language }
    it { is_expected.to eq ['one', 'two'] }
  end

  describe "visibility" do
    subject { document.visibility }

    context "when open" do
      let(:attributes) { { 'read_access_group_ssim' => ['public'] } }
      it { is_expected.to eq 'open' }
    end

    context "when authenticated" do
      let(:attributes) { { 'read_access_group_ssim' => ['registered'] } }
      it { is_expected.to eq 'authenticated' }
    end

    context "when restricted" do
      let(:attributes) { {} }
      it { is_expected.to eq 'restricted' }
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
curation_concerns-1.4.0 spec/models/solr_document_spec.rb
curation_concerns-1.3.3 spec/models/solr_document_spec.rb
curation_concerns-1.3.2 spec/models/solr_document_spec.rb
curation_concerns-1.3.1 spec/models/solr_document_spec.rb
curation_concerns-1.3.0 spec/models/solr_document_spec.rb
curation_concerns-1.2.0 spec/models/solr_document_spec.rb
curation_concerns-1.1.2 spec/models/solr_document_spec.rb
curation_concerns-1.1.1 spec/models/solr_document_spec.rb
curation_concerns-1.1.0 spec/models/solr_document_spec.rb
curation_concerns-1.0.0 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta10 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta9 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta8 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta7 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta6 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta5 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta4 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta3 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta2 spec/models/solr_document_spec.rb
curation_concerns-1.0.0.beta1 spec/models/solr_document_spec.rb