Sha256: d2f4b2aa0f8b53d4bfc03a2d64b8d2d517a9df251a0ac78baf5743a0d1bacf50
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' describe "rdf associations" do context "when there is one relationship for the predicate" do before do class Foo < ActiveFedora::Base end class Library < ActiveFedora::Base has_and_belongs_to_many :foos, predicate: ::RDF::URI('http://example.com') end end after do Object.send(:remove_const, :Foo) Object.send(:remove_const, :Library) end let(:library) { Library.new } it "doesn't not bother to filter by class type" do expect(library.association(:foo_ids)).not_to receive(:filter_by_class) library.foos.to_a end end context "when two relationships have the same predicate" do before do class Foo < ActiveFedora::Base end class Bar < ActiveFedora::Base end class Library < ActiveFedora::Base has_and_belongs_to_many :foos, predicate: ::RDF::URI('http://example.com') has_and_belongs_to_many :bars, predicate: ::RDF::URI('http://example.com') end end after do Object.send(:remove_const, :Foo) Object.send(:remove_const, :Bar) Object.send(:remove_const, :Library) end let(:library) { Library.new } it "filters by class type" do expect(library.association(:foo_ids)).to receive(:filter_by_class).and_call_original library.foos.to_a end end end
Version data entries
4 entries across 4 versions & 1 rubygems