Sha256: d79617de56b2292912e487cdf7b706f4cc23a9644d585790b5180a2377d371c2

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 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::DC.title
            property :title2, predicate: ::RDF::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::DC.title
            property :title2, predicate: ::RDF::DC.creator
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active-fedora-9.6.2 spec/unit/property_predicate_spec.rb
active-fedora-9.6.1 spec/unit/property_predicate_spec.rb