Sha256: e0d358e3cf5aa0e5e30516b92d7e713aff4fbca92bc49c431ae0181b8a9b1f93

Contents?: true

Size: 1.41 KB

Versions: 20

Compression:

Stored size: 1.41 KB

Contents

RSpec.shared_examples "a non-collection model" do
  describe "roles granted to creator" do
    subject { described_class.new }
    let(:user) { FactoryGirl.build(:user) }
    before { subject.grant_roles_to_creator(user) }
    it "includes the Editor role in resource scope" do
      expect(subject.roles.to_a).to eq([Ddr::Auth::Roles::Role.build(type: "Editor", agent: user.agent, scope: "resource")])
    end
  end

  describe "admin set" do
    subject { described_class.new }
    let(:collection) { FactoryGirl.build(:collection) }
    let(:admin_set) { Ddr::Models::AdminSet.new(code: "foobar", title: "FooBar") }
    before {
      allow(Ddr::Models::AdminSet).to receive(:find_by_code).with("foobar") { admin_set }
      collection.admin_set = "foobar"
      collection.save!
      subject.admin_policy = collection
    }
    it "indexes the admin set title" do
      expect(subject.to_solr[Ddr::Index::Fields::ADMIN_SET_TITLE]).to eq("FooBar")
    end
  end

  describe "collection title" do
    subject { described_class.new }
    let(:collection) { FactoryGirl.create(:collection) }
    before {
      subject.admin_policy = collection
    }
    it "indexes the collection title" do
      expect(subject.to_solr[Ddr::Index::Fields::COLLECTION_TITLE]).to eq("Test Collection")
    end
  end

  describe "attachments" do
    its(:can_have_attachments?) { is_expected.to be false }
    it { is_expected.not_to have_attachments }
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ddr-models-2.11.0 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.10.2 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.10.1 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.10.0 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.10.0.rc2 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.10.0.rc1 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.9.2 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.9.1 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.9.0 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.9.0.rc1 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.8.0 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.8.0.rc1 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.7.6 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.7.5 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.7.4 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.7.3 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.7.2 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.7.1 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.7.0 spec/support/shared_examples_for_non_collection_models.rb
ddr-models-2.7.0.rc1 spec/support/shared_examples_for_non_collection_models.rb