active-fedora 3.1.6 → 3.2.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile.lock +22 -22
  3. data/History.txt +9 -3
  4. data/active-fedora.gemspec +3 -3
  5. data/config/predicate_mappings.yml +1 -0
  6. data/config/service_mappings.yml +9 -0
  7. data/lib/active_fedora.rb +7 -1
  8. data/lib/active_fedora/base.rb +84 -30
  9. data/lib/active_fedora/datastream.rb +4 -1
  10. data/lib/active_fedora/datastream_collections.rb +304 -293
  11. data/lib/active_fedora/metadata_datastream.rb +2 -24
  12. data/lib/active_fedora/metadata_datastream_helper.rb +32 -5
  13. data/lib/active_fedora/named_relationships.rb +95 -0
  14. data/lib/active_fedora/nested_attributes.rb +1 -1
  15. data/lib/active_fedora/predicates.rb +76 -0
  16. data/lib/active_fedora/reflection.rb +9 -1
  17. data/lib/active_fedora/relationship.rb +1 -0
  18. data/lib/active_fedora/relationship_graph.rb +152 -0
  19. data/lib/active_fedora/relationships_helper.rb +32 -41
  20. data/lib/active_fedora/rels_ext_datastream.rb +3 -10
  21. data/lib/active_fedora/semantic_node.rb +47 -203
  22. data/lib/active_fedora/service_definitions.rb +89 -0
  23. data/lib/active_fedora/unsaved_digital_object.rb +40 -0
  24. data/lib/active_fedora/version.rb +1 -1
  25. data/spec/integration/base_spec.rb +106 -309
  26. data/spec/integration/datastream_collections_spec.rb +135 -0
  27. data/spec/integration/rels_ext_datastream_spec.rb +14 -35
  28. data/spec/integration/semantic_node_spec.rb +6 -10
  29. data/spec/unit/base_datastream_management_spec.rb +0 -3
  30. data/spec/unit/base_extra_spec.rb +5 -9
  31. data/spec/unit/base_spec.rb +103 -57
  32. data/spec/unit/{base_named_datastream_spec.rb → datastream_collections_spec.rb} +107 -150
  33. data/spec/unit/metadata_datastream_spec.rb +0 -1
  34. data/spec/unit/nokogiri_datastream_spec.rb +0 -1
  35. data/spec/unit/predicates_spec.rb +64 -0
  36. data/spec/unit/qualified_dublin_core_datastream_spec.rb +0 -7
  37. data/spec/unit/relationship_graph_spec.rb +95 -0
  38. data/spec/unit/relationship_spec.rb +4 -4
  39. data/spec/unit/relationships_helper_spec.rb +43 -104
  40. data/spec/unit/rels_ext_datastream_spec.rb +6 -6
  41. data/spec/unit/semantic_node_spec.rb +27 -116
  42. data/spec/unit/service_definitions_spec.rb +52 -0
  43. data/spec/unit/solr_config_options_spec.rb +1 -1
  44. metadata +35 -17
@@ -0,0 +1,95 @@
1
+ require 'spec_helper'
2
+
3
+ describe ActiveFedora::RelationshipGraph do
4
+ before do
5
+ @graph = ActiveFedora::RelationshipGraph.new
6
+ end
7
+
8
+
9
+ it "should add relationships" do
10
+ @n1 = ActiveFedora::Base.new
11
+ @n2 = ActiveFedora::Base.new
12
+ @graph.add(:has_part, @n1)
13
+ @graph.relationships[:has_part].should == [@n1]
14
+ @graph.add(:has_part, @n2)
15
+ @graph.relationships[:has_part].should == [@n1, @n2]
16
+ @graph.add(:has_part, @n2)
17
+ @graph.relationships[:has_part].should == [@n1, @n2]
18
+ @graph.dirty.should be_true
19
+ end
20
+
21
+ it "should create a rdf graph" do
22
+ graph = @graph.to_graph('info:fedora/foo:1')
23
+ graph.should be_kind_of RDF::Graph
24
+ graph.statements.to_a.should == []
25
+
26
+ @n1 = ActiveFedora::Base.new(:pid=>'foo:777')
27
+ @graph.add(:has_part, @n1)
28
+ graph = @graph.to_graph('info:fedora/foo:1')
29
+ stmts = graph.statements.to_a
30
+ stmts.size.should == 1
31
+ stmt = stmts.first
32
+ stmt.subject.to_s.should == 'info:fedora/foo:1'
33
+ stmt.predicate.to_s.should == 'info:fedora/fedora-system:def/relations-external#hasPart'
34
+ stmt.object.to_s.should == 'info:fedora/foo:777'
35
+
36
+ end
37
+
38
+ it "should have array accessor" do
39
+ @n1 = ActiveFedora::Base.new(:pid=>'foo:777')
40
+ @graph.add(:has_part, @n1)
41
+ @graph[:has_part].should == [@n1]
42
+ end
43
+
44
+
45
+ describe "delete" do
46
+ it "should delete an object when an object is passed" do
47
+ @n1 = ActiveFedora::Base.new(:pid=>'foo:777')
48
+ @graph.add(:has_part, @n1)
49
+ @graph[:has_part].should == [@n1]
50
+ @graph.delete(:has_part, @n1)
51
+ @graph[:has_part].should == []
52
+ end
53
+ it "should delete an pid when an object is passed" do
54
+ #a reloaded rels-ext is just a list of uris, not inflated.
55
+ @n1 = ActiveFedora::Base.new(:pid=>'foo:777')
56
+ @graph.add(:has_part, 'info:fedora/foo:777')
57
+ @graph[:has_part].should == ['info:fedora/foo:777']
58
+ @graph.delete(:has_part, @n1)
59
+ @graph[:has_part].should == []
60
+ end
61
+ it "should delete an pid when a string is passed" do
62
+ #a reloaded rels-ext is just a list of uris, not inflated.
63
+ @n1 = ActiveFedora::Base.new(:pid=>'foo:777')
64
+ @graph.add(:has_part, 'info:fedora/foo:777')
65
+ @graph[:has_part].should == ['info:fedora/foo:777']
66
+ @graph.delete(:has_part, 'info:fedora/foo:777')
67
+ @graph[:has_part].should == []
68
+ end
69
+ it "should delete an object when a pid is passed" do
70
+ #a reloaded rels-ext is just a list of uris, not inflated.
71
+ @n1 = ActiveFedora::Base.new(:pid=>'foo:777')
72
+ @graph.add(:has_part, @n1)
73
+ @graph[:has_part].should == [@n1]
74
+ @graph.delete(:has_part, 'info:fedora/foo:777')
75
+ @graph[:has_part].should == []
76
+ end
77
+ end
78
+ describe "build_statement" do
79
+ it "should raise an error when the target is a pid, not a uri" do
80
+ lambda { @graph.build_statement('info:fedora/spec:9', :is_part_of, 'spec:7') }.should raise_error ArgumentError
81
+ end
82
+ it "should run the happy path" do
83
+ stm = @graph.build_statement('info:fedora/spec:9', :is_part_of, 'info:fedora/spec:7')
84
+ stm.object.to_s.should == "info:fedora/spec:7"
85
+ end
86
+ it "should also be happy with non-info URIs" do
87
+ stm = @graph.build_statement('info:fedora/spec:9', :is_annotation_of, 'http://www.w3.org/standards/techs/rdf')
88
+ stm.object.to_s.should == "http://www.w3.org/standards/techs/rdf"
89
+ end
90
+ it "should also be happy with targets that are URI::Generics" do
91
+ stm = @graph.build_statement('info:fedora/spec:9', :is_annotation_of, URI.parse('http://www.w3.org/standards/techs/rdf'))
92
+ stm.object.to_s.should == "http://www.w3.org/standards/techs/rdf"
93
+ end
94
+ end
95
+ end
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  require 'active_fedora'
4
+ require 'active_fedora/relationship'
4
5
  require "rexml/document"
5
6
  require 'mocha'
6
7
  require 'uri'
@@ -24,6 +25,8 @@ describe ActiveFedora::Relationship do
24
25
  end
25
26
  /%
26
27
  before(:each) do
28
+ ActiveSupport::Deprecation.expects(:warn).with("ActiveFedora::Releationship is deprecated and will be removed in the next release").twice
29
+
27
30
  @test_relationship = ActiveFedora::Relationship.new
28
31
  @test_literal = ActiveFedora::Relationship.new(:is_literal=>true)
29
32
  end
@@ -33,6 +36,7 @@ describe ActiveFedora::Relationship do
33
36
  end
34
37
 
35
38
  describe "#new" do
39
+ ActiveSupport::Deprecation.expects(:warn).with("ActiveFedora::Releationship is deprecated and will be removed in the next release").twice
36
40
  test_relationship = ActiveFedora::Relationship.new(:subject => "demo:5", :predicate => "isMemberOf", :object => "demo:10")
37
41
 
38
42
  test_relationship.subject.should == "info:fedora/demo:5"
@@ -84,8 +88,4 @@ describe ActiveFedora::Relationship do
84
88
  end
85
89
  end
86
90
 
87
- describe "#to_hash" do
88
- it "should return a hash of structure {subject => {predicate => [object]}}"
89
- end
90
-
91
91
  end
@@ -10,6 +10,9 @@ class SpecNamedNode
10
10
  include ActiveFedora::RelationshipsHelper
11
11
 
12
12
  attr_accessor :pid
13
+ def internal_uri
14
+ 'info:fedora/' + pid.to_s
15
+ end
13
16
  end
14
17
 
15
18
  describe ActiveFedora::RelationshipsHelper do
@@ -51,10 +54,9 @@ describe ActiveFedora::RelationshipsHelper do
51
54
 
52
55
  it 'should check if current object is the kind of model class supplied' do
53
56
  #has_model relationship does not get created until save called
54
- r = ActiveFedora::Relationship.new({:subject=>:self,:predicate=>:has_model,:object=>ActiveFedora::ContentModel.pid_from_ruby_class(SpecNamedNode)})
55
57
  graph = RDF::Graph.new
56
58
  subject = RDF::URI.new "info:fedora/test:sample_pid"
57
- graph.insert RDF::Statement.new(subject, ActiveFedora::Base.new.find_graph_predicate(:has_model), RDF::URI.new(r.object))
59
+ graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model), RDF::URI.new(ActiveFedora::ContentModel.pid_from_ruby_class(SpecNamedNode)))
58
60
  @test_object.expects(:relationships).returns(graph).at_least_once
59
61
  @test_object.conforms_to?(SpecNamedNode).should == true
60
62
  end
@@ -69,10 +71,9 @@ describe ActiveFedora::RelationshipsHelper do
69
71
  @test_object3 = SpecNamedNode.new
70
72
  @test_object3.pid = increment_pid
71
73
  #has_model relationship does not get created until save called so need to add the has model rel here, is fine since not testing save
72
- r = ActiveFedora::Relationship.new({:subject=>:self,:predicate=>:has_model,:object=>ActiveFedora::ContentModel.pid_from_ruby_class(SpecNamedNode)})
73
74
  graph = RDF::Graph.new
74
75
  subject = RDF::URI.new "info:fedora/test:sample_pid"
75
- graph.insert RDF::Statement.new(subject, ActiveFedora::Base.new.find_graph_predicate(:has_model), RDF::URI.new(r.object))
76
+ graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model), RDF::URI.new(ActiveFedora::ContentModel.pid_from_ruby_class(SpecNamedNode)))
76
77
  @test_object.expects(:relationships).returns(graph).at_least_once
77
78
  @test_object3.assert_conforms_to('object',@test_object,SpecNamedNode)
78
79
  end
@@ -107,20 +108,19 @@ describe ActiveFedora::RelationshipsHelper do
107
108
  @test_object2.pid = increment_pid
108
109
  @test_object3 = MockNamedRelationships3.new
109
110
  @test_object3.pid = increment_pid
110
- r = ActiveFedora::Relationship.new({:subject=>:self,:predicate=>:has_model,:object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockNamedRelationships3)})
111
+ model_pid = ActiveFedora::ContentModel.pid_from_ruby_class(MockNamedRelationships3)
111
112
  graph = RDF::Graph.new
112
113
  subject = RDF::URI.new "info:fedora/test:sample_pid"
113
- graph.insert RDF::Statement.new(subject, ActiveFedora::Base.new.find_graph_predicate(:has_model), RDF::URI.new(r.object))
114
+ graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model), RDF::URI.new(model_pid))
114
115
  @test_object2.expects(:relationships).returns(graph).at_least_once
115
116
  #should return expected named relationships
116
117
  @test_object2.relationships_by_name.should == {:self=>{"testing"=>[],"testing2"=>[]}}
117
- r3 = ActiveFedora::Relationship.new({:subject=>:self,:predicate=>:has_part,:object=>@test_object})
118
118
  graph = RDF::Graph.new
119
119
  subject = RDF::URI.new "info:fedora/test:sample_pid"
120
- graph.insert RDF::Statement.new(subject, ActiveFedora::Base.new.find_graph_predicate(:has_model), RDF::URI.new(r.object))
121
- graph.insert RDF::Statement.new(subject, ActiveFedora::Base.new.find_graph_predicate(:has_part), RDF::URI.new(r3.object))
120
+ graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model), RDF::URI.new(model_pid))
121
+ graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_part), RDF::URI.new(@test_object.internal_uri))
122
122
  @test_object3.expects(:relationships).returns(graph).at_least_once
123
- @test_object3.relationships_by_name.should == {:self=>{"testing"=>[r3.object],"testing2"=>[]}}
123
+ @test_object3.relationships_by_name.should == {:self=>{"testing"=>[@test_object.internal_uri],"testing2"=>[]}}
124
124
  end
125
125
  end
126
126
 
@@ -206,21 +206,18 @@ describe ActiveFedora::RelationshipsHelper do
206
206
  it 'should return an array of object uri for a given relationship name' do
207
207
  @test_object2 = MockRelationshipNames.new
208
208
  @test_object2.pid = increment_pid
209
- r = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:has_model, :object=>ActiveFedora::ContentModel.pid_from_ruby_class(MockRelationshipNames))
210
209
  @test_object3 = SpecNamedNode.new
211
210
  @test_object3.pid = increment_pid
212
211
  @test_object4 = SpecNamedNode.new
213
212
  @test_object4.pid = increment_pid
214
213
  #add relationships that mirror 'testing' and 'testing2'
215
- r3 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:has_part, :object=>@test_object3)
216
- r4 = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>:has_member, :object=>@test_object4)
217
214
  graph = RDF::Graph.new
218
215
  subject = RDF::URI.new "info:fedora/test:sample_pid"
219
- graph.insert RDF::Statement.new(subject, ActiveFedora::Base.new.find_graph_predicate(:has_model), RDF::URI.new(r.object))
220
- graph.insert RDF::Statement.new(subject, ActiveFedora::Base.new.find_graph_predicate(:has_member), RDF::URI.new(r4.object))
221
- graph.insert RDF::Statement.new(subject, ActiveFedora::Base.new.find_graph_predicate(:has_part), RDF::URI.new(r3.object))
216
+ graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model), RDF::URI.new(ActiveFedora::ContentModel.pid_from_ruby_class(MockRelationshipNames)))
217
+ graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_member), RDF::URI.new(@test_object4.internal_uri))
218
+ graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_part), RDF::URI.new(@test_object3.internal_uri))
222
219
  @test_object2.expects(:relationships).returns(graph).at_least_once
223
- @test_object2.find_relationship_by_name("testing").should == [r3.object]
220
+ @test_object2.find_relationship_by_name("testing").should == [@test_object3.internal_uri]
224
221
  end
225
222
  end
226
223
 
@@ -503,9 +500,7 @@ describe ActiveFedora::RelationshipsHelper do
503
500
  # named_predicate_exists_with_different_name?(subject,name,predicate)
504
501
  describe "named_relationships_desc" do
505
502
  it 'should throw deprecation warning if old method name called and should call new method name' do
506
- logger = mock()
507
- logger.expects(:warn).with("Deprecation: named_relationships_desc has been deprecated. Please call relationships_desc instead.")
508
- @test_object.class.expects(:logger).returns(logger)
503
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationships_desc has been deprecated. Please call relationships_desc instead.")
509
504
  @test_object.class.respond_to?(:relationships_desc)
510
505
  obj = mock()
511
506
  @test_object.class.expects(:relationships_desc)
@@ -515,9 +510,7 @@ describe ActiveFedora::RelationshipsHelper do
515
510
 
516
511
  describe "register_named_subject" do
517
512
  it 'should throw deprecation warning if old method name called and should call new method name' do
518
- logger = mock()
519
- logger.expects(:warn).with("Deprecation: register_named_subject has been deprecated. Please call register_relationship_desc_subject instead.")
520
- @test_object.class.expects(:logger).returns(logger)
513
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: register_named_subject has been deprecated. Please call register_relationship_desc_subject instead.")
521
514
  @test_object.class.respond_to?(:register_relationship_desc_subject)
522
515
  obj = mock()
523
516
  @test_object.class.expects(:register_relationship_desc_subject).with(:self)
@@ -527,9 +520,7 @@ describe ActiveFedora::RelationshipsHelper do
527
520
 
528
521
  describe "register_named_relationship" do
529
522
  it 'should throw deprecation warning if old method name called and should call new method name' do
530
- logger = mock()
531
- logger.expects(:warn).with("Deprecation: register_named_relationship has been deprecated. Please call register_relationship_desc instead.")
532
- @test_object.class.expects(:logger).returns(logger)
523
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: register_named_relationship has been deprecated. Please call register_relationship_desc instead.")
533
524
  @test_object.class.respond_to?(:register_relationship_desc)
534
525
  obj = mock()
535
526
  @test_object.class.expects(:register_relationship_desc).with(:self,"testing",:has_member,{})
@@ -539,9 +530,7 @@ describe ActiveFedora::RelationshipsHelper do
539
530
 
540
531
  describe "create_named_relationship_methods" do
541
532
  it 'should throw deprecation warning if old method name called and should call new method name' do
542
- logger = mock()
543
- logger.expects(:warn).with("Deprecation: create_named_relationship_methods has been deprecated. Please call create_relationship_name_methods instead.")
544
- @test_object.class.expects(:logger).returns(logger)
533
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: create_named_relationship_methods has been deprecated. Please call create_relationship_name_methods instead.")
545
534
  @test_object.class.respond_to?(:create_relationship_name_methods)
546
535
  obj = mock()
547
536
  @test_object.class.expects(:create_relationship_name_methods).with("testing")
@@ -551,9 +540,7 @@ describe ActiveFedora::RelationshipsHelper do
551
540
 
552
541
  describe "create_bidirectional_named_relationship_methods" do
553
542
  it 'should throw deprecation warning if old method name called and should call new method name' do
554
- logger = mock()
555
- logger.expects(:warn).with("Deprecation: create_bidirectional_named_relationship_methods has been deprecated. Please call create_bidirectional_relationship_name_methods instead.")
556
- @test_object.class.expects(:logger).returns(logger)
543
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: create_bidirectional_named_relationship_methods has been deprecated. Please call create_bidirectional_relationship_name_methods instead.")
557
544
  @test_object.class.respond_to?(:create_bidirectional_relationship_name_methods)
558
545
  obj = mock()
559
546
  @test_object.class.expects(:create_bidirectional_relationship_name_methods).with("testing","testing_outbound")
@@ -563,9 +550,7 @@ describe ActiveFedora::RelationshipsHelper do
563
550
 
564
551
  describe "outbound_named_relationship_query" do
565
552
  it 'should throw deprecation warning if old method name called and should call new method name' do
566
- logger = mock()
567
- logger.expects(:warn).with("Deprecation: outbound_named_relationship_query has been deprecated. Please call outbound_relationship_query instead.")
568
- @test_object.class.expects(:logger).returns(logger)
553
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: outbound_named_relationship_query has been deprecated. Please call outbound_relationship_query instead.")
569
554
  @test_object.class.respond_to?(:outbound_relationship_query)
570
555
  obj = mock()
571
556
  @test_object.class.expects(:outbound_relationship_query).with("testing",["testid"])
@@ -575,9 +560,7 @@ describe ActiveFedora::RelationshipsHelper do
575
560
 
576
561
  describe "inbound_named_relationship_query" do
577
562
  it 'should throw deprecation warning if old method name called and should call new method name' do
578
- logger = mock()
579
- logger.expects(:warn).with("Deprecation: inbound_named_relationship_query has been deprecated. Please call inbound_relationship_query instead.")
580
- @test_object.class.expects(:logger).returns(logger)
563
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: inbound_named_relationship_query has been deprecated. Please call inbound_relationship_query instead.")
581
564
  @test_object.class.respond_to?(:inbound_relationship_query)
582
565
  obj = mock()
583
566
  @test_object.class.expects(:inbound_relationship_query).with("testid","testing")
@@ -587,9 +570,7 @@ describe ActiveFedora::RelationshipsHelper do
587
570
 
588
571
  describe "bidirectional_named_relationship_query" do
589
572
  it 'should throw deprecation warning if old method name called and should call new method name' do
590
- logger = mock()
591
- logger.expects(:warn).with("Deprecation: bidirectional_named_relationship_query has been deprecated. Please call bidirectional_relationship_query instead.")
592
- @test_object.class.expects(:logger).returns(logger)
573
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: bidirectional_named_relationship_query has been deprecated. Please call bidirectional_relationship_query instead.")
593
574
  @test_object.class.respond_to?(:bidirectional_relationship_query)
594
575
  obj = mock()
595
576
  @test_object.class.expects(:bidirectional_relationship_query).with("testid","testing",["testid2"])
@@ -599,9 +580,7 @@ describe ActiveFedora::RelationshipsHelper do
599
580
 
600
581
  describe "named_predicate_exists_with_different_name?" do
601
582
  it 'should throw deprecation warning if old method name called and should call new method name' do
602
- logger = mock()
603
- logger.expects(:warn).with("Deprecation: named_predicate_exists_with_different_name? has been deprecated. Please call predicate_exists_with_different_relationship_name? instead.")
604
- @test_object.class.expects(:logger).returns(logger)
583
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_predicate_exists_with_different_name? has been deprecated. Please call predicate_exists_with_different_relationship_name? instead.")
605
584
  @test_object.class.respond_to?(:predicate_exists_with_different_relationship_name?)
606
585
  obj = mock()
607
586
  @test_object.class.expects(:predicate_exists_with_different_relationship_name?).with(:subject,"testing",:has_member)
@@ -636,9 +615,7 @@ describe ActiveFedora::RelationshipsHelper do
636
615
 
637
616
  describe "named_relationship" do
638
617
  it 'should throw deprecation warning if old method name called and should call new method name' do
639
- logger = mock()
640
- logger.expects(:warn).with("Deprecation: named_relationship has been deprecated. Please call find_relationship_by_name instead.")
641
- @test_object.expects(:logger).returns(logger)
618
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationship has been deprecated. Please call find_relationship_by_name instead.")
642
619
  @test_object.respond_to?(:find_relationship_by_name).should == true
643
620
  @test_object.expects(:find_relationship_by_name).with("testing")
644
621
  @test_object.named_relationship("testing")
@@ -647,9 +624,7 @@ describe ActiveFedora::RelationshipsHelper do
647
624
 
648
625
  describe "register_named_subject" do
649
626
  it 'should throw deprecation warning if old method name called and should call new method name' do
650
- logger = mock()
651
- logger.expects(:warn).with("Deprecation: register_named_subject has been deprecated. Please call register_relationship_desc_subject instead.")
652
- @test_object.expects(:logger).returns(logger)
627
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: register_named_subject has been deprecated. Please call register_relationship_desc_subject instead.")
653
628
  @test_object.respond_to?(:register_relationship_desc_subject).should == true
654
629
  @test_object.expects(:register_relationship_desc_subject).with(:self)
655
630
  @test_object.register_named_subject(:self)
@@ -658,9 +633,7 @@ describe ActiveFedora::RelationshipsHelper do
658
633
 
659
634
  describe "register_named_relationship" do
660
635
  it 'should throw deprecation warning if old method name called and should call new method name' do
661
- logger = mock()
662
- logger.expects(:warn).with("Deprecation: register_named_relationship has been deprecated. Please call register_relationship_desc instead.")
663
- @test_object.expects(:logger).returns(logger)
636
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: register_named_relationship has been deprecated. Please call register_relationship_desc instead.")
664
637
  @test_object.respond_to?(:register_relationship_desc).should == true
665
638
  @test_object.expects(:register_relationship_desc).with(:self,"testing",:has_member,{})
666
639
  @test_object.register_named_relationship(:self,"testing",:has_member,{})
@@ -669,9 +642,7 @@ describe ActiveFedora::RelationshipsHelper do
669
642
 
670
643
  describe "named_relationships" do
671
644
  it 'should throw deprecation warning if old method name called and should call new method name' do
672
- logger = mock()
673
- logger.expects(:warn).with("Deprecation: named_relationships has been deprecated. Please call relationships_by_name instead.")
674
- @test_object.expects(:logger).returns(logger)
645
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationships has been deprecated. Please call relationships_by_name instead.")
675
646
  @test_object.respond_to?(:relationships_by_name).should == true
676
647
  @test_object.expects(:relationships_by_name)
677
648
  @test_object.named_relationships
@@ -680,9 +651,7 @@ describe ActiveFedora::RelationshipsHelper do
680
651
 
681
652
  describe "named_relationships_from_class" do
682
653
  it 'should throw deprecation warning if old method name called and should call new method name' do
683
- logger = mock()
684
- logger.expects(:warn).with("Deprecation: named_relationships_from_class has been deprecated. Please call relationships_by_name_from_class instead.")
685
- @test_object.expects(:logger).returns(logger)
654
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationships_from_class has been deprecated. Please call relationships_by_name_from_class instead.")
686
655
  @test_object.respond_to?(:relationships_by_name_from_class).should == true
687
656
  @test_object.expects(:relationships_by_name_from_class)
688
657
  @test_object.named_relationships_from_class
@@ -691,9 +660,7 @@ describe ActiveFedora::RelationshipsHelper do
691
660
 
692
661
  describe "named_inbound_relationships" do
693
662
  it 'should throw deprecation warning if old method name called and should call new method name' do
694
- logger = mock()
695
- logger.expects(:warn).with("Deprecation: named_inbound_relationships has been deprecated. Please call inbound_relationships_by_name instead.")
696
- @test_object.expects(:logger).returns(logger)
663
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_inbound_relationships has been deprecated. Please call inbound_relationships_by_name instead.")
697
664
  @test_object.respond_to?(:inbound_relationships_by_name).should == true
698
665
  @test_object.expects(:inbound_relationships_by_name)
699
666
  @test_object.named_inbound_relationships
@@ -702,9 +669,7 @@ describe ActiveFedora::RelationshipsHelper do
702
669
 
703
670
  describe "named_outbound_relationships" do
704
671
  it 'should throw deprecation warning if old method name called and should call new method name' do
705
- logger = mock()
706
- logger.expects(:warn).with("Deprecation: named_outbound_relationships has been deprecated. Please call outbound_relationships_by_name instead.")
707
- @test_object.expects(:logger).returns(logger)
672
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_outbound_relationships has been deprecated. Please call outbound_relationships_by_name instead.")
708
673
  @test_object.respond_to?(:outbound_relationships_by_name).should == true
709
674
  @test_object.expects(:outbound_relationships_by_name)
710
675
  @test_object.named_outbound_relationships
@@ -713,9 +678,7 @@ describe ActiveFedora::RelationshipsHelper do
713
678
 
714
679
  describe "outbound_named_relationship_predicates" do
715
680
  it 'should throw deprecation warning if old method name called and should call new method name' do
716
- logger = mock()
717
- logger.expects(:warn).with("Deprecation: outbound_named_relationship_predicates has been deprecated. Please call outbound_relationship_predicates instead.")
718
- @test_object.expects(:logger).returns(logger)
681
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: outbound_named_relationship_predicates has been deprecated. Please call outbound_relationship_predicates instead.")
719
682
  @test_object.respond_to?(:outbound_relationship_predicates).should == true
720
683
  @test_object.expects(:outbound_relationship_predicates)
721
684
  @test_object.outbound_named_relationship_predicates
@@ -724,9 +687,7 @@ describe ActiveFedora::RelationshipsHelper do
724
687
 
725
688
  describe "inbound_named_relationship_predicates" do
726
689
  it 'should throw deprecation warning if old method name called and should call new method name' do
727
- logger = mock()
728
- logger.expects(:warn).with("Deprecation: inbound_named_relationship_predicates has been deprecated. Please call inbound_relationship_predicates instead.")
729
- @test_object.expects(:logger).returns(logger)
690
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: inbound_named_relationship_predicates has been deprecated. Please call inbound_relationship_predicates instead.")
730
691
  @test_object.respond_to?(:inbound_relationship_predicates).should == true
731
692
  @test_object.expects(:inbound_relationship_predicates)
732
693
  @test_object.inbound_named_relationship_predicates
@@ -735,9 +696,7 @@ describe ActiveFedora::RelationshipsHelper do
735
696
 
736
697
  describe "named_relationship_predicates" do
737
698
  it 'should throw deprecation warning if old method name called and should call new method name' do
738
- logger = mock()
739
- logger.expects(:warn).with("Deprecation: named_relationship_predicates has been deprecated. Please call relationship_predicates instead.")
740
- @test_object.expects(:logger).returns(logger)
699
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationship_predicates has been deprecated. Please call relationship_predicates instead.")
741
700
  @test_object.respond_to?(:relationship_predicates).should == true
742
701
  @test_object.expects(:relationship_predicates)
743
702
  @test_object.named_relationship_predicates
@@ -746,9 +705,7 @@ describe ActiveFedora::RelationshipsHelper do
746
705
 
747
706
  describe "named_relationship_predicates_from_class" do
748
707
  it 'should throw deprecation warning if old method name called and should call new method name' do
749
- logger = mock()
750
- logger.expects(:warn).with("Deprecation: named_relationship_predicates_from_class has been deprecated. Please call relationship_predicates_from_class instead.")
751
- @test_object.expects(:logger).returns(logger)
708
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationship_predicates_from_class has been deprecated. Please call relationship_predicates_from_class instead.")
752
709
  @test_object.respond_to?(:relationship_predicates_from_class).should == true
753
710
  @test_object.expects(:relationship_predicates_from_class)
754
711
  @test_object.named_relationship_predicates_from_class
@@ -757,9 +714,7 @@ describe ActiveFedora::RelationshipsHelper do
757
714
 
758
715
  describe "is_named_relationship?" do
759
716
  it 'should throw deprecation warning if old method name called and should call new method name' do
760
- logger = mock()
761
- logger.expects(:warn).with("Deprecation: is_named_relationship? has been deprecated. Please call is_relationship_name? instead.")
762
- @test_object.expects(:logger).returns(logger)
717
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: is_named_relationship? has been deprecated. Please call is_relationship_name? instead.")
763
718
  @test_object.respond_to?(:is_relationship_name?).should == true
764
719
  @test_object.expects(:is_relationship_name?)
765
720
  @test_object.is_named_relationship?("testing",true)
@@ -768,9 +723,7 @@ describe ActiveFedora::RelationshipsHelper do
768
723
 
769
724
  describe "named_relationships_desc" do
770
725
  it 'should throw deprecation warning if old method name called and should call new method name' do
771
- logger = mock()
772
- logger.expects(:warn).with("Deprecation: named_relationships_desc has been deprecated. Please call relationships_desc instead.")
773
- @test_object.expects(:logger).returns(logger)
726
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationships_desc has been deprecated. Please call relationships_desc instead.")
774
727
  @test_object.respond_to?(:relationships_desc)
775
728
  @test_object.expects(:relationships_desc)
776
729
  @test_object.named_relationships_desc
@@ -779,9 +732,7 @@ describe ActiveFedora::RelationshipsHelper do
779
732
 
780
733
  describe "named_relationships_desc_from_class" do
781
734
  it 'should throw deprecation warning if old method name called and should call new method name' do
782
- logger = mock()
783
- logger.expects(:warn).with("Deprecation: named_relationships_desc_from_class has been deprecated. Please call relationships_desc_from_class instead.")
784
- @test_object.expects(:logger).returns(logger)
735
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationships_desc_from_class has been deprecated. Please call relationships_desc_from_class instead.")
785
736
  @test_object.respond_to?(:relationships_desc_from_class)
786
737
  @test_object.expects(:relationships_desc_from_class)
787
738
  @test_object.named_relationships_desc_from_class
@@ -790,9 +741,7 @@ describe ActiveFedora::RelationshipsHelper do
790
741
 
791
742
  describe "named_relationship_type" do
792
743
  it 'should throw deprecation warning if old method name called and should call new method name' do
793
- logger = mock()
794
- logger.expects(:warn).with("Deprecation: named_relationship_type has been deprecated. Please call relationship_model_type instead.")
795
- @test_object.expects(:logger).returns(logger)
744
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationship_type has been deprecated. Please call relationship_model_type instead.")
796
745
  @test_object.respond_to?(:relationship_model_type)
797
746
  @test_object.expects(:relationship_model_type).with("testing")
798
747
  @test_object.named_relationship_type("testing")
@@ -801,9 +750,7 @@ describe ActiveFedora::RelationshipsHelper do
801
750
 
802
751
  describe "add_named_relationship" do
803
752
  it 'should throw deprecation warning if old method name called and should call new method name' do
804
- logger = mock()
805
- logger.expects(:warn).with("Deprecation: add_named_relationship has been deprecated. Please call add_relationship_by_name instead.")
806
- @test_object.expects(:logger).returns(logger)
753
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: add_named_relationship has been deprecated. Please call add_relationship_by_name instead.")
807
754
  @test_object.respond_to?(:add_relationship_by_name)
808
755
  obj = mock()
809
756
  @test_object.expects(:add_relationship_by_name).with("testing",obj)
@@ -813,9 +760,7 @@ describe ActiveFedora::RelationshipsHelper do
813
760
 
814
761
  describe "remove_named_relationship" do
815
762
  it 'should throw deprecation warning if old method name called and should call new method name' do
816
- logger = mock()
817
- logger.expects(:warn).with("Deprecation: remove_named_relationship has been deprecated. Please call remove_relationship_by_name instead.")
818
- @test_object.expects(:logger).returns(logger)
763
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: remove_named_relationship has been deprecated. Please call remove_relationship_by_name instead.")
819
764
  @test_object.respond_to?(:remove_relationship_by_name)
820
765
  obj = mock()
821
766
  @test_object.expects(:remove_relationship_by_name).with("testing",obj)
@@ -825,9 +770,7 @@ describe ActiveFedora::RelationshipsHelper do
825
770
 
826
771
  describe "assert_kind_of_model" do
827
772
  it 'should throw deprecation warning if old method name called and should call new method name' do
828
- logger = mock()
829
- logger.expects(:warn).with("Deprecation: assert_kind_of_model has been deprecated. Please call assert_conforms_to instead.")
830
- @test_object.expects(:logger).returns(logger)
773
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: assert_kind_of_model has been deprecated. Please call assert_conforms_to instead.")
831
774
  @test_object.respond_to?(:assert_conforms_to)
832
775
  obj = mock()
833
776
  @test_object.expects(:assert_conforms_to).with("testing",obj,ActiveFedora::Base)
@@ -837,9 +780,7 @@ describe ActiveFedora::RelationshipsHelper do
837
780
 
838
781
  describe "kind_of_model?" do
839
782
  it 'should throw deprecation warning if old method name called and should call new method name' do
840
- logger = mock()
841
- logger.expects(:warn).with("Deprecation: kind_of_model? has been deprecated. Please call conforms_to? instead.")
842
- @test_object.expects(:logger).returns(logger)
783
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: kind_of_model? has been deprecated. Please call conforms_to? instead.")
843
784
  @test_object.respond_to?(:conforms_to?)
844
785
  obj = mock()
845
786
  @test_object.expects(:conforms_to?).with(ActiveFedora::Base)
@@ -849,9 +790,7 @@ describe ActiveFedora::RelationshipsHelper do
849
790
 
850
791
  describe "named_relationship_query" do
851
792
  it 'should throw deprecation warning if old method name called and should call new method name' do
852
- logger = mock()
853
- logger.expects(:warn).with("Deprecation: named_relationship_query has been deprecated. Please call relationship_query instead.")
854
- @test_object.expects(:logger).returns(logger)
793
+ ActiveSupport::Deprecation.expects(:warn).with("Deprecation: named_relationship_query has been deprecated. Please call relationship_query instead.")
855
794
  @test_object.respond_to?(:relationship_query)
856
795
  obj = mock()
857
796
  @test_object.expects(:relationship_query).with("testing")