Sha256: bfd0a4185ae12f3a33b1793c736195a897e540e2206bf98a8f4b931d639bed8b

Contents?: true

Size: 1.13 KB

Versions: 73

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe ActiveFedora::Base do
  describe ".property" do
    context "when the same predicate is used for two properties" do
      let(:warningMsg) { "Same predicate (http://purl.org/dc/terms/title) used for properties title1 and title2" }

      it "warns" do
        # Note that the expect test must be before the class is parsed.
        expect(described_class.logger).to receive(:warn).with(warningMsg)

        module TestModel1
          class Book < ActiveFedora::Base
            property :title1, predicate: ::RDF::Vocab::DC.title
            property :title2, predicate: ::RDF::Vocab::DC.title
          end
        end
      end
    end

    context "when properties are created with different predicates" do
      it "does not warn" do
        # Note that the expect test must be before the class is parsed.
        expect(described_class.logger).to_not receive(:warn)

        module TestModel2
          class Book < ActiveFedora::Base
            property :title1, predicate: ::RDF::Vocab::DC.title
            property :title2, predicate: ::RDF::Vocab::DC.creator
          end
        end
      end
    end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
active-fedora-12.2.4 spec/unit/property_predicate_spec.rb
active-fedora-12.2.3 spec/unit/property_predicate_spec.rb
active-fedora-11.5.6 spec/unit/property_predicate_spec.rb
active-fedora-12.2.2 spec/unit/property_predicate_spec.rb
active-fedora-11.2.1 spec/unit/property_predicate_spec.rb
active-fedora-12.2.1 spec/unit/property_predicate_spec.rb
active-fedora-12.0.3 spec/unit/property_predicate_spec.rb
active-fedora-11.5.5 spec/unit/property_predicate_spec.rb
active-fedora-13.1.2 spec/unit/property_predicate_spec.rb
active-fedora-13.1.1 spec/unit/property_predicate_spec.rb
active-fedora-13.1.0 spec/unit/property_predicate_spec.rb
active-fedora-13.0.0 spec/unit/property_predicate_spec.rb
active-fedora-12.1.1 spec/unit/property_predicate_spec.rb
active-fedora-12.1.0 spec/unit/property_predicate_spec.rb
active-fedora-11.5.4 spec/unit/property_predicate_spec.rb
active-fedora-11.5.3 spec/unit/property_predicate_spec.rb
active-fedora-12.0.2 spec/unit/property_predicate_spec.rb
active-fedora-12.0.1 spec/unit/property_predicate_spec.rb
active-fedora-11.5.2 spec/unit/property_predicate_spec.rb
active-fedora-12.0.0 spec/unit/property_predicate_spec.rb