active-fedora 10.3.0.rc1 → 10.3.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c2ca88ff43a634f8f901f9903d0121e1401dddb
4
- data.tar.gz: 4511d14bc32be2d2ca0b66ec375fbfe924a83628
3
+ metadata.gz: bfce14d5c623e569206f59c02700d667e34bde26
4
+ data.tar.gz: ead2d01f58a36fc8afac60ddfc9825fd1e581d53
5
5
  SHA512:
6
- metadata.gz: df9190770e94bc983a500af74ad24860fee001d0bbbced86605d95bbf6d5a34199fa63ec7fa16947400f4b0509444fac8553b71f7bc9c8602bc422e67c2d23e1
7
- data.tar.gz: 5a86bba90263e21c7d1fc30f8a9951939576d97488ae9e1f564aadf6fd279a47a38b2b3256a8c8cfdd95e2f957a95c145c3a27fd4a430f5bc669041f3c611295
6
+ metadata.gz: c61d8f7606b23f0cbff48e4280711cab4b1237d245590b775cead65ca4b65907ee6b000b8bcef23bafd41cc2bb8f84dd194edb220589f9e510e2712a47885cc8
7
+ data.tar.gz: b5af3107ec86f44ab5e56926e678601430f855ea8c962e193dc90eff90b2db46fde9bc6de6ed68f36cc64a7173986d6d56b05848b0f79e02b5c7788101758656
@@ -83,7 +83,7 @@ module ActiveFedora
83
83
  protected
84
84
 
85
85
  def find_polymorphic_inverse(record)
86
- record.reflections.values.find { |r| !r.has_many? && r.options[:property] == reflection.options[:property] }
86
+ record.reflections.values.find { |r| !r.has_many? && r.predicate == reflection.predicate }
87
87
  end
88
88
 
89
89
  # Deletes the records according to the <tt>:dependent</tt> option.
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "10.3.0.rc1".freeze
2
+ VERSION = "10.3.0.rc2".freeze
3
3
  end
@@ -32,19 +32,34 @@ describe ActiveFedora::Associations::HasManyAssociation do
32
32
  end
33
33
  end
34
34
 
35
- describe "Finding a polymorphic inverse relation" do
36
- before do
37
- # :books must come first, so that we can test that is being passed over in favor of :contents
38
- Page.has_many :books, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf, class_name: 'ActiveFedora::Base'
39
- Page.has_and_belongs_to_many :contents, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf, class_name: 'ActiveFedora::Base'
40
- end
35
+ describe "#find_polymorphic_inverse" do
41
36
  let(:book_reflection) { ActiveFedora::Reflection.create(:has_many, 'pages', nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf }, Book) }
42
37
  let(:association) { described_class.new(book, book_reflection) }
43
38
 
44
- subject { association.send(:find_polymorphic_inverse, page) }
39
+ subject(:inverse) { association.send(:find_polymorphic_inverse, page) }
40
+
41
+ context "when a has_many is present" do
42
+ before do
43
+ # :books must come first, so that we can test that is being passed over in favor of :contents
44
+ Page.has_many :books, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf, class_name: 'ActiveFedora::Base'
45
+ Page.has_and_belongs_to_many :contents, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf, class_name: 'ActiveFedora::Base'
46
+ end
47
+
48
+ it "finds the HABTM reflection" do
49
+ expect(inverse.name).to eq :contents
50
+ end
51
+ end
52
+
53
+ context "when multiple belongs_to are present" do
54
+ before do
55
+ # :foo must come first, so that we can test that is being passed over in favor of :bar
56
+ Page.belongs_to :foo, predicate: ::RDF::Vocab::DC.isPartOf, class_name: 'ActiveFedora::Base'
57
+ Page.belongs_to :bar, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf, class_name: 'ActiveFedora::Base'
58
+ end
45
59
 
46
- it "finds the HABTM reflection" do
47
- expect(subject.name).to eq :contents
60
+ it "finds the belongs_to reflection" do
61
+ expect(inverse.name).to eq :bar
62
+ end
48
63
  end
49
64
  end
50
65
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.3.0.rc1
4
+ version: 10.3.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt