active-fedora 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/active-fedora.gemspec +5 -2
- data/lib/active_fedora/base.rb +19 -4
- data/lib/active_fedora/nokogiri_datastream.rb +228 -6
- data/lib/active_fedora/semantic_node.rb +23 -3
- data/lib/fedora/connection.rb +7 -4
- data/spec/fixtures/dino_jpg_no_file_ext +0 -0
- data/spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml +58 -11
- data/spec/fixtures/mods_articles/hydrangea_article1.xml +24 -16
- data/spec/integration/base_spec.rb +145 -60
- data/spec/integration/nokogiri_datastream_spec.rb +60 -0
- data/spec/unit/base_named_datastream_spec.rb +3 -1
- data/spec/unit/nokogiri_datastream_spec.rb +110 -4
- data/spec/unit/semantic_node_spec.rb +45 -0
- metadata +7 -4
@@ -383,6 +383,17 @@ describe ActiveFedora::SemanticNode do
|
|
383
383
|
ActiveFedora::SolrService.instance.conn.expects(:query).with("is_part_of_s:info\\:fedora/test\\:sample_pid OR #{id_array_query}").returns(solr_result)
|
384
384
|
@local_node.all_parts(:response_format=>:solr)
|
385
385
|
end
|
386
|
+
|
387
|
+
it "should register both inbound and outbound predicate components" do
|
388
|
+
@local_node.relationships[:inbound].has_key?(:is_part_of).should == true
|
389
|
+
@local_node.relationships[:self].has_key?(:has_part).should == true
|
390
|
+
end
|
391
|
+
|
392
|
+
it "should register relationship names for inbound, outbound" do
|
393
|
+
@local_node.relationship_names.include?("all_parts_inbound").should == true
|
394
|
+
@local_node.relationship_names.include?("all_parts_outbound").should == true
|
395
|
+
end
|
396
|
+
|
386
397
|
end
|
387
398
|
|
388
399
|
describe "#has_bidirectional_relationship" do
|
@@ -390,6 +401,25 @@ describe ActiveFedora::SemanticNode do
|
|
390
401
|
SpecNode.expects(:create_bidirectional_relationship_finders).with("all_parts", :has_part, :is_part_of, {})
|
391
402
|
SpecNode.has_bidirectional_relationship("all_parts", :has_part, :is_part_of)
|
392
403
|
end
|
404
|
+
|
405
|
+
it "should have named_relationship and relationship hashes contain bidirectionally related objects" do
|
406
|
+
SpecNode.has_bidirectional_relationship("all_parts", :has_part, :is_part_of)
|
407
|
+
@local_node = SpecNode.new
|
408
|
+
@local_node.pid = "mypid1"
|
409
|
+
@local_node2 = SpecNode.new
|
410
|
+
@local_node2.pid = "mypid2"
|
411
|
+
r = ActiveFedora::Relationship.new({:subject=>:self,:predicate=>:has_model,:object=>ActiveFedora::ContentModel.pid_from_ruby_class(SpecNode)})
|
412
|
+
@local_node.add_relationship(r)
|
413
|
+
@local_node2.add_relationship(r)
|
414
|
+
r2 = ActiveFedora::Relationship.new({:subject=>:self,:predicate=>:has_part,:object=>@local_node2})
|
415
|
+
@local_node.add_relationship(r2)
|
416
|
+
r3 = ActiveFedora::Relationship.new({:subject=>:self,:predicate=>:has_part,:object=>@local_node})
|
417
|
+
@local_node2.add_relationship(r3)
|
418
|
+
@local_node.relationships.should == {:self=>{:has_model=>[r.object],:has_part=>[r2.object]},:inbound=>{:is_part_of=>[]}}
|
419
|
+
@local_node2.relationships.should == {:self=>{:has_model=>[r.object],:has_part=>[r3.object]},:inbound=>{:is_part_of=>[]}}
|
420
|
+
@local_node.named_relationships.should == {:self=>{"all_parts_outbound"=>[r2.object]},:inbound=>{"all_parts_inbound"=>[]}}
|
421
|
+
@local_node2.named_relationships.should == {:self=>{"all_parts_outbound"=>[r3.object]},:inbound=>{"all_parts_inbound"=>[]}}
|
422
|
+
end
|
393
423
|
end
|
394
424
|
|
395
425
|
describe ".add_relationship" do
|
@@ -847,6 +877,21 @@ describe ActiveFedora::SemanticNode do
|
|
847
877
|
#test execution in base_spec since method definitions include methods in ActiveFedora::Base
|
848
878
|
end
|
849
879
|
end
|
880
|
+
|
881
|
+
describe '#create_bidirectional_named_relationship_methods' do
|
882
|
+
class MockCreateNamedRelationshipMethods < SpecNode2
|
883
|
+
register_named_relationship :self, "testing_outbound", :is_part_of, :type=>SpecNode2
|
884
|
+
create_bidirectional_named_relationship_methods "testing", "testing_outbound"
|
885
|
+
end
|
886
|
+
|
887
|
+
it 'should create an append and remove method for each outbound relationship' do
|
888
|
+
@test_object2 = MockCreateNamedRelationshipMethods.new
|
889
|
+
@test_object2.pid = increment_pid
|
890
|
+
@test_object2.should respond_to(:testing_append)
|
891
|
+
@test_object2.should respond_to(:testing_remove)
|
892
|
+
#test execution in base_spec since method definitions include methods in ActiveFedora::Base
|
893
|
+
end
|
894
|
+
end
|
850
895
|
|
851
896
|
describe '#def named_predicate_exists_with_different_name?' do
|
852
897
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 7
|
10
|
+
version: 1.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Zumwalt
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-11-14 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -400,6 +400,7 @@ files:
|
|
400
400
|
- solr/config/solrconfig-1.5.xml
|
401
401
|
- spec/fixtures/changeme155.xml
|
402
402
|
- spec/fixtures/dino.jpg
|
403
|
+
- spec/fixtures/dino_jpg_no_file_ext
|
403
404
|
- spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml
|
404
405
|
- spec/fixtures/minivan.jpg
|
405
406
|
- spec/fixtures/mods_articles/hydrangea_article1.xml
|
@@ -418,6 +419,7 @@ files:
|
|
418
419
|
- spec/integration/metadata_datastream_helper_spec.rb
|
419
420
|
- spec/integration/model_spec.rb
|
420
421
|
- spec/integration/mods_article_integration_spec.rb
|
422
|
+
- spec/integration/nokogiri_datastream_spec.rb
|
421
423
|
- spec/integration/rels_ext_datastream_spec.rb
|
422
424
|
- spec/integration/repository_spec.rb
|
423
425
|
- spec/integration/rf_fedora_object_spec.rb
|
@@ -507,6 +509,7 @@ test_files:
|
|
507
509
|
- spec/integration/metadata_datastream_helper_spec.rb
|
508
510
|
- spec/integration/model_spec.rb
|
509
511
|
- spec/integration/mods_article_integration_spec.rb
|
512
|
+
- spec/integration/nokogiri_datastream_spec.rb
|
510
513
|
- spec/integration/rels_ext_datastream_spec.rb
|
511
514
|
- spec/integration/repository_spec.rb
|
512
515
|
- spec/integration/rf_fedora_object_spec.rb
|