active-fedora 8.7.0 → 9.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +8 -15
  3. data/Gemfile +5 -5
  4. data/History.txt +0 -80
  5. data/README.md +1 -0
  6. data/Rakefile +0 -3
  7. data/active-fedora.gemspec +8 -7
  8. data/config/fedora.yml +5 -4
  9. data/config/predicate_mappings.yml +5 -5
  10. data/gemfiles/rails4.1.gemfile +10 -0
  11. data/gemfiles/rails4.2.beta.gemfile +10 -0
  12. data/lib/active_fedora.rb +151 -117
  13. data/lib/active_fedora/associations.rb +47 -15
  14. data/lib/active_fedora/associations/association.rb +29 -8
  15. data/lib/active_fedora/associations/association_scope.rb +5 -5
  16. data/lib/active_fedora/associations/belongs_to_association.rb +20 -63
  17. data/lib/active_fedora/associations/builder/association.rb +61 -25
  18. data/lib/active_fedora/associations/builder/belongs_to.rb +7 -94
  19. data/lib/active_fedora/associations/builder/collection_association.rb +11 -43
  20. data/lib/active_fedora/associations/builder/contains.rb +28 -0
  21. data/lib/active_fedora/associations/builder/has_and_belongs_to_many.rb +13 -3
  22. data/lib/active_fedora/associations/builder/has_many.rb +16 -10
  23. data/lib/active_fedora/associations/builder/property.rb +14 -0
  24. data/lib/active_fedora/associations/builder/singular_association.rb +14 -18
  25. data/lib/active_fedora/associations/builder/singular_property.rb +12 -0
  26. data/lib/active_fedora/associations/collection_association.rb +57 -80
  27. data/lib/active_fedora/associations/contains_association.rb +50 -0
  28. data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +44 -24
  29. data/lib/active_fedora/associations/has_many_association.rb +46 -14
  30. data/lib/active_fedora/associations/rdf.rb +86 -0
  31. data/lib/active_fedora/associations/singular_association.rb +4 -8
  32. data/lib/active_fedora/associations/singular_rdf.rb +15 -0
  33. data/lib/active_fedora/attached_files.rb +195 -0
  34. data/lib/active_fedora/attribute_methods.rb +122 -0
  35. data/lib/active_fedora/attribute_methods/dirty.rb +16 -0
  36. data/lib/active_fedora/attribute_methods/read.rb +61 -0
  37. data/lib/active_fedora/attribute_methods/write.rb +47 -0
  38. data/lib/active_fedora/attributes.rb +93 -44
  39. data/lib/active_fedora/attributes/primary_key.rb +12 -0
  40. data/lib/active_fedora/autosave_association.rb +2 -2
  41. data/lib/active_fedora/base.rb +16 -15
  42. data/lib/active_fedora/callbacks.rb +7 -7
  43. data/lib/active_fedora/change_set.rb +34 -0
  44. data/lib/active_fedora/cleaner.rb +62 -0
  45. data/lib/active_fedora/config.rb +4 -22
  46. data/lib/active_fedora/core.rb +173 -99
  47. data/lib/active_fedora/datastream.rb +4 -117
  48. data/lib/active_fedora/datastreams.rb +2 -263
  49. data/lib/active_fedora/datastreams/nokogiri_datastreams.rb +28 -51
  50. data/lib/active_fedora/{datastream_attribute.rb → delegated_attribute.rb} +57 -26
  51. data/lib/active_fedora/errors.rb +61 -0
  52. data/lib/active_fedora/fedora.rb +19 -0
  53. data/lib/active_fedora/fedora_attributes.rb +58 -26
  54. data/lib/active_fedora/file.rb +318 -0
  55. data/lib/active_fedora/file_configurator.rb +32 -32
  56. data/lib/active_fedora/file_path_builder.rb +24 -0
  57. data/lib/active_fedora/files_hash.rb +82 -0
  58. data/lib/active_fedora/fixity_service.rb +40 -0
  59. data/lib/active_fedora/indexing.rb +55 -82
  60. data/lib/active_fedora/indexing_service.rb +70 -0
  61. data/lib/active_fedora/ldp_resource.rb +26 -0
  62. data/lib/active_fedora/loadable_from_json.rb +112 -0
  63. data/lib/active_fedora/model.rb +5 -19
  64. data/lib/active_fedora/nested_attributes.rb +5 -6
  65. data/lib/active_fedora/nom_datastream.rb +15 -25
  66. data/lib/active_fedora/om_datastream.rb +26 -197
  67. data/lib/active_fedora/persistence.rb +95 -71
  68. data/lib/active_fedora/predicates.rb +4 -4
  69. data/lib/active_fedora/qualified_dublin_core_datastream.rb +17 -18
  70. data/lib/active_fedora/querying.rb +3 -4
  71. data/lib/active_fedora/railtie.rb +3 -6
  72. data/lib/active_fedora/rdf.rb +3 -1
  73. data/lib/active_fedora/rdf/datastream_indexing.rb +11 -0
  74. data/lib/active_fedora/rdf/fcrepo.rb +10 -324
  75. data/lib/active_fedora/rdf/indexing.rb +20 -16
  76. data/lib/active_fedora/rdf/ldp.rb +6 -0
  77. data/lib/active_fedora/rdf/ntriples_rdf_datastream.rb +1 -1
  78. data/lib/active_fedora/rdf/persistence.rb +5 -6
  79. data/lib/active_fedora/rdf/rdf_datastream.rb +44 -37
  80. data/lib/active_fedora/rdf/rdfxml_datastream.rb +13 -0
  81. data/lib/active_fedora/rdf/rels_ext.rb +26 -0
  82. data/lib/active_fedora/reflection.rb +256 -199
  83. data/lib/active_fedora/relation.rb +18 -6
  84. data/lib/active_fedora/relation/finder_methods.rb +69 -38
  85. data/lib/active_fedora/relation/query_methods.rb +7 -3
  86. data/lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb +7 -7
  87. data/lib/active_fedora/rspec_matchers/have_many_associated_active_fedora_objects_matcher.rb +8 -8
  88. data/lib/active_fedora/rspec_matchers/have_predicate_matcher.rb +9 -11
  89. data/lib/active_fedora/simple_datastream.rb +18 -13
  90. data/lib/active_fedora/solr_instance_loader.rb +18 -38
  91. data/lib/active_fedora/solr_service.rb +37 -20
  92. data/lib/active_fedora/sparql_insert.rb +45 -0
  93. data/lib/active_fedora/test_support.rb +1 -22
  94. data/lib/active_fedora/version.rb +1 -1
  95. data/lib/active_fedora/versionable.rb +90 -0
  96. data/lib/active_fedora/with_metadata.rb +37 -0
  97. data/lib/active_fedora/with_metadata/metadata_node.rb +70 -0
  98. data/lib/generators/active_fedora/config/config_generator.rb +0 -1
  99. data/lib/generators/active_fedora/config/solr/solr_generator.rb +1 -1
  100. data/lib/generators/active_fedora/model/model_generator.rb +5 -5
  101. data/lib/generators/active_fedora/model/templates/datastream_spec.rb.erb +1 -1
  102. data/lib/generators/active_fedora/model/templates/model_spec.rb.erb +2 -2
  103. data/lib/tasks/active_fedora_dev.rake +21 -27
  104. data/spec/config_helper.rb +1 -1
  105. data/spec/fixtures/mixed_rdf_descMetadata.nt +6 -6
  106. data/spec/fixtures/rails_root/config/predicate_mappings.yml +3 -19
  107. data/spec/fixtures/solr_rdf_descMetadata.nt +6 -6
  108. data/spec/integration/associations_spec.rb +133 -153
  109. data/spec/integration/attached_files_spec.rb +164 -0
  110. data/spec/integration/attributes_spec.rb +73 -12
  111. data/spec/integration/autosave_association_spec.rb +3 -3
  112. data/spec/integration/base_spec.rb +57 -351
  113. data/spec/integration/belongs_to_association_spec.rb +86 -76
  114. data/spec/integration/bug_spec.rb +3 -3
  115. data/spec/integration/collection_association_spec.rb +4 -4
  116. data/spec/integration/complex_rdf_datastream_spec.rb +54 -56
  117. data/spec/integration/delete_all_spec.rb +18 -15
  118. data/spec/integration/eradicate_spec.rb +54 -0
  119. data/spec/integration/fedora_solr_sync_spec.rb +7 -5
  120. data/spec/integration/field_to_solr_name_spec.rb +5 -5
  121. data/spec/integration/file_fixity_spec.rb +40 -0
  122. data/spec/integration/file_spec.rb +122 -0
  123. data/spec/integration/full_featured_model_spec.rb +53 -63
  124. data/spec/integration/has_and_belongs_to_many_associations_spec.rb +141 -114
  125. data/spec/integration/has_many_associations_spec.rb +142 -64
  126. data/spec/integration/json_serialization_spec.rb +50 -8
  127. data/spec/integration/model_spec.rb +12 -29
  128. data/spec/integration/nested_attribute_spec.rb +28 -20
  129. data/spec/integration/ntriples_datastream_spec.rb +60 -57
  130. data/spec/integration/om_datastream_spec.rb +51 -140
  131. data/spec/integration/rdf_nested_attributes_spec.rb +16 -14
  132. data/spec/integration/relation_delegation_spec.rb +7 -9
  133. data/spec/integration/relation_spec.rb +9 -7
  134. data/spec/integration/scoped_query_spec.rb +26 -26
  135. data/spec/integration/solr_instance_loader_spec.rb +69 -53
  136. data/spec/integration/solr_service_spec.rb +12 -73
  137. data/spec/integration/versionable_spec.rb +477 -0
  138. data/spec/integration/with_metadata_spec.rb +52 -0
  139. data/spec/samples/hydra-mods_article_datastream.rb +10 -6
  140. data/spec/samples/models/mods_article.rb +6 -2
  141. data/spec/samples/oral_history_sample.xml +1 -1
  142. data/spec/samples/oral_history_xml.xml +1 -1
  143. data/spec/samples/special_thing.rb +3 -3
  144. data/spec/spec_helper.rb +22 -12
  145. data/spec/support/an_active_model.rb +3 -7
  146. data/spec/unit/active_fedora_spec.rb +20 -17
  147. data/spec/unit/attached_files_spec.rb +203 -0
  148. data/spec/unit/attributes_spec.rb +286 -207
  149. data/spec/unit/base_active_model_spec.rb +8 -8
  150. data/spec/unit/base_datastream_management_spec.rb +11 -24
  151. data/spec/unit/base_extra_spec.rb +17 -67
  152. data/spec/unit/base_spec.rb +163 -428
  153. data/spec/unit/builder/has_and_belongs_to_many_spec.rb +2 -2
  154. data/spec/unit/callback_spec.rb +38 -23
  155. data/spec/unit/change_set_spec.rb +46 -0
  156. data/spec/unit/code_configurator_spec.rb +5 -5
  157. data/spec/unit/config_spec.rb +9 -14
  158. data/spec/unit/core_spec.rb +59 -8
  159. data/spec/unit/file_configurator_spec.rb +55 -53
  160. data/spec/unit/file_path_builder_spec.rb +18 -0
  161. data/spec/unit/file_spec.rb +221 -0
  162. data/spec/unit/files_hash_spec.rb +53 -0
  163. data/spec/unit/fixity_service_spec.rb +34 -0
  164. data/spec/unit/has_and_belongs_to_many_association_spec.rb +134 -0
  165. data/spec/unit/has_many_association_spec.rb +51 -0
  166. data/spec/unit/indexing_service_spec.rb +23 -0
  167. data/spec/unit/indexing_spec.rb +26 -0
  168. data/spec/unit/inheritance_spec.rb +9 -10
  169. data/spec/unit/model_spec.rb +15 -33
  170. data/spec/unit/nom_datastream_spec.rb +13 -10
  171. data/spec/unit/ntriples_datastream_spec.rb +81 -96
  172. data/spec/unit/om_datastream_spec.rb +137 -227
  173. data/spec/unit/persistence_spec.rb +28 -34
  174. data/spec/unit/predicates_spec.rb +29 -29
  175. data/spec/unit/property_spec.rb +1 -3
  176. data/spec/unit/qualified_dublin_core_datastream_spec.rb +27 -32
  177. data/spec/unit/query_spec.rb +116 -149
  178. data/spec/unit/rdf_datastream_spec.rb +25 -43
  179. data/spec/unit/rdf_resource_datastream_spec.rb +24 -123
  180. data/spec/unit/{rdfxml_rdf_datastream_spec.rb → rdfxml_datastream_spec.rb} +21 -25
  181. data/spec/unit/readonly_spec.rb +23 -0
  182. data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +6 -6
  183. data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +6 -6
  184. data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +6 -6
  185. data/spec/unit/serializers_spec.rb +1 -1
  186. data/spec/unit/simple_datastream_spec.rb +12 -23
  187. data/spec/unit/solr_config_options_spec.rb +14 -17
  188. data/spec/unit/solr_service_spec.rb +38 -77
  189. data/spec/unit/sparql_insert_spec.rb +32 -0
  190. data/spec/unit/validations_spec.rb +8 -11
  191. metadata +96 -121
  192. data/lib/active_fedora/auditable.rb +0 -9
  193. data/lib/active_fedora/content_model.rb +0 -70
  194. data/lib/active_fedora/datastream_collections.rb +0 -302
  195. data/lib/active_fedora/datastream_hash.rb +0 -35
  196. data/lib/active_fedora/digital_object.rb +0 -55
  197. data/lib/active_fedora/fixture_exporter.rb +0 -33
  198. data/lib/active_fedora/fixture_loader.rb +0 -48
  199. data/lib/active_fedora/rdf/identifiable.rb +0 -66
  200. data/lib/active_fedora/rdf/project_hydra.rb +0 -12
  201. data/lib/active_fedora/rdf/rdfxml_rdf_datastream.rb +0 -13
  202. data/lib/active_fedora/rdf_xml_writer.rb +0 -49
  203. data/lib/active_fedora/relationship_graph.rb +0 -101
  204. data/lib/active_fedora/reload_on_save.rb +0 -16
  205. data/lib/active_fedora/rels_ext_datastream.rb +0 -100
  206. data/lib/active_fedora/rspec_matchers/match_fedora_datastream_matcher.rb +0 -41
  207. data/lib/active_fedora/rubydora_connection.rb +0 -35
  208. data/lib/active_fedora/semantic_node.rb +0 -164
  209. data/lib/active_fedora/service_definitions.rb +0 -88
  210. data/lib/active_fedora/sharding.rb +0 -58
  211. data/lib/active_fedora/solr_digital_object.rb +0 -68
  212. data/lib/active_fedora/unsaved_digital_object.rb +0 -58
  213. data/lib/generators/active_fedora/config/fedora/fedora_generator.rb +0 -12
  214. data/lib/generators/active_fedora/config/fedora/templates/fedora.yml +0 -38
  215. data/lib/generators/active_fedora/config/fedora/templates/fedora_conf/conf/development/fedora.fcfg +0 -953
  216. data/lib/generators/active_fedora/config/fedora/templates/fedora_conf/conf/test/fedora.fcfg +0 -953
  217. data/lib/tasks/active_fedora.rake +0 -83
  218. data/spec/fixtures/sharded_fedora.yml +0 -11
  219. data/spec/integration/auditable_spec.rb +0 -29
  220. data/spec/integration/datastream_collections_spec.rb +0 -127
  221. data/spec/integration/datastream_spec.rb +0 -90
  222. data/spec/integration/datastreams_spec.rb +0 -173
  223. data/spec/integration/load_from_solr_spec.rb +0 -66
  224. data/spec/integration/rels_ext_datastream_spec.rb +0 -82
  225. data/spec/support/mock_fedora.rb +0 -44
  226. data/spec/unit/content_model_spec.rb +0 -86
  227. data/spec/unit/datastream_collections_spec.rb +0 -420
  228. data/spec/unit/datastream_spec.rb +0 -83
  229. data/spec/unit/datastreams_spec.rb +0 -243
  230. data/spec/unit/has_and_belongs_to_many_collection_spec.rb +0 -96
  231. data/spec/unit/has_many_collection_spec.rb +0 -35
  232. data/spec/unit/rdf_vocab_spec.rb +0 -30
  233. data/spec/unit/rdf_xml_writer_spec.rb +0 -63
  234. data/spec/unit/relationship_graph_spec.rb +0 -115
  235. data/spec/unit/reload_on_save_spec.rb +0 -24
  236. data/spec/unit/rels_ext_datastream_spec.rb +0 -170
  237. data/spec/unit/rspec_matchers/match_fedora_datastream_matcher_spec.rb +0 -44
  238. data/spec/unit/rubydora_connection_spec.rb +0 -12
  239. data/spec/unit/semantic_node_spec.rb +0 -112
  240. data/spec/unit/service_definitions_spec.rb +0 -63
  241. data/spec/unit/solr_digital_object_spec.rb +0 -97
  242. data/spec/unit/unsaved_digital_object_spec.rb +0 -48
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe ActiveFedora::Associations::Builder::HasAndBelongsToMany do
4
4
  describe "valid_options" do
5
5
  subject { ActiveFedora::Associations::Builder::HasAndBelongsToMany.valid_options }
6
- it { is_expected.to eq [:class_name, :property, :before_add, :after_add, :before_remove, :after_remove,
7
- :inverse_of, :solr_page_size, :autosave] }
6
+ it { should eq [:class_name, :predicate, :before_add, :after_add, :before_remove,
7
+ :after_remove, :inverse_of, :solr_page_size, :autosave] }
8
8
  end
9
9
  end
@@ -1,7 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Base do
4
- before :all do
4
+ before :each do
5
+ begin
6
+ ActiveFedora::Base.find('test:123').delete
7
+ rescue
8
+ end
9
+
5
10
  class CallbackStub < ActiveFedora::Base
6
11
  has_metadata :type=>ActiveFedora::SimpleDatastream, :name=>"someData" do |m|
7
12
  m.field "fubar", :string
@@ -25,31 +30,41 @@ describe ActiveFedora::Base do
25
30
  end
26
31
  end
27
32
  end
28
- after :all do
33
+ after :each do
34
+ @cb.destroy if @cb && @cb.persisted?# this only is called if the test failed to run all the way through.
29
35
  Object.send(:remove_const, :CallbackStub)
30
36
  end
31
37
 
32
38
  it "Should have after_initialize, before_save,after_save, before_create, after_create, after_update, before_update, before_destroy" do
33
- expect_any_instance_of(CallbackStub).to receive(:a_init)
34
- expect_any_instance_of(CallbackStub).to receive :b_create
35
- expect_any_instance_of(CallbackStub).to receive :a_create
36
- expect_any_instance_of(CallbackStub).to receive(:b_save)
37
- expect_any_instance_of(CallbackStub).to receive(:a_save)
38
- cb = CallbackStub.new :pid => 'test:123'
39
- cb.save
40
- end
41
- it "Should have after_initialize, before_save,after_save, before_create, after_create, after_update, before_update, before_destroy" do
42
- expect_any_instance_of(CallbackStub).to receive(:a_init)
43
- expect_any_instance_of(CallbackStub).to receive(:b_save)
44
- expect_any_instance_of(CallbackStub).to receive(:a_save)
45
- expect_any_instance_of(CallbackStub).to receive(:a_find)
46
- expect_any_instance_of(CallbackStub).to receive(:b_update)
47
- expect_any_instance_of(CallbackStub).to receive(:a_update)
48
- expect_any_instance_of(CallbackStub).to receive(:do_stuff)
49
-
50
- cb2 = CallbackStub.find('test:123')
51
- cb2.save
52
-
53
- cb2.destroy
39
+ allow_any_instance_of(CallbackStub).to receive(:a_init)
40
+ allow_any_instance_of(CallbackStub).to receive :b_create
41
+ allow_any_instance_of(CallbackStub).to receive :a_create
42
+ allow_any_instance_of(CallbackStub).to receive(:b_save)
43
+ allow_any_instance_of(CallbackStub).to receive(:a_save)
44
+ @cb = CallbackStub.new 'test:123'
45
+ @cb.save
46
+ end
47
+
48
+ it "Should have after_initialize, before_save,after_save, before_create, after_create, after_update, before_update, before_destroy" do
49
+ allow_any_instance_of(CallbackStub).to receive(:a_init)
50
+ allow_any_instance_of(CallbackStub).to receive(:b_create)
51
+ allow_any_instance_of(CallbackStub).to receive(:a_create)
52
+ allow_any_instance_of(CallbackStub).to receive(:b_save)
53
+ allow_any_instance_of(CallbackStub).to receive(:a_save)
54
+ @cb = CallbackStub.new 'test:123'
55
+ @cb.save
56
+ allow_any_instance_of(CallbackStub).to receive(:a_init)
57
+ allow_any_instance_of(CallbackStub).to receive(:b_save)
58
+ allow_any_instance_of(CallbackStub).to receive(:a_save)
59
+ allow_any_instance_of(CallbackStub).to receive(:a_find)
60
+ allow_any_instance_of(CallbackStub).to receive(:b_update)
61
+ allow_any_instance_of(CallbackStub).to receive(:a_update)
62
+ allow_any_instance_of(CallbackStub).to receive(:do_stuff)
63
+
64
+ @cb = CallbackStub.find('test:123')
65
+ @cb.save!
66
+
67
+ @cb.destroy
68
+
54
69
  end
55
70
  end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe ActiveFedora::ChangeSet do
4
+ let(:change_set) { described_class.new(base, base.resource, base.changed_attributes.keys) }
5
+ subject { change_set }
6
+
7
+ context "with an unchanged object" do
8
+ let(:base) { ActiveFedora::Base.new }
9
+
10
+ it { is_expected.to be_empty }
11
+ end
12
+
13
+ context "with a changed object" do
14
+ before do
15
+ class Library < ActiveFedora::Base
16
+ end
17
+
18
+ class Book < ActiveFedora::Base
19
+ belongs_to :library, predicate: ActiveFedora::RDF::RelsExt.hasConstituent
20
+ property :title, predicate: ::RDF::DC.title
21
+ end
22
+
23
+ base.library_id = 'foo'
24
+ base.title = ['bar']
25
+ end
26
+ after do
27
+ Object.send(:remove_const, :Library)
28
+ Object.send(:remove_const, :Book)
29
+ end
30
+
31
+ let(:base) { Book.create }
32
+
33
+
34
+ describe "#changes" do
35
+ subject { change_set.changes }
36
+
37
+ it { is_expected.to be_kind_of Hash }
38
+
39
+ it "should have two elements" do
40
+ expect(subject.size).to eq 2
41
+ end
42
+ end
43
+
44
+ it { is_expected.to_not be_empty }
45
+ end
46
+ end
@@ -18,9 +18,9 @@ describe ActiveFedora::FileConfigurator do
18
18
  :fedora_config => { :url => 'http://codeconfig.example.edu/fedora/', :user => 'fedoraAdmin', :password => 'configurator', :cert_file => '/path/to/cert/file' },
19
19
  :solr_config => { :url => 'http://codeconfig.example.edu/solr/' },
20
20
  :predicate_config => {
21
- :default_namespace => 'info:fedora/fedora-system:def/relations-external#',
21
+ :default_namespace => 'http://fedora.info/definitions/v4/rels-ext#',
22
22
  :predicate_mapping => {
23
- 'info:fedora/fedora-system:def/relations-external#' => { :has_part => 'hasPart' }
23
+ 'http://fedora.info/definitions/v4/rels-ext#' => { :has_part => 'hasPart' }
24
24
  }
25
25
  }
26
26
  }
@@ -43,9 +43,9 @@ describe ActiveFedora::FileConfigurator do
43
43
  expect(File).to receive(:read).never
44
44
  expect(File).to receive(:open).never
45
45
  ActiveFedora.init(@config_params)
46
- expect(ActiveFedora.fedora_config.credentials).to eq(@config_params[:fedora_config])
47
- expect(ActiveFedora.solr_config).to eq(@config_params[:solr_config])
48
- expect(ActiveFedora::Predicates.predicate_mappings['info:fedora/fedora-system:def/relations-external#'].length).to eq(1)
46
+ expect(ActiveFedora.fedora_config.credentials).to eq @config_params[:fedora_config]
47
+ expect(ActiveFedora.solr_config).to eq @config_params[:solr_config]
48
+ expect(ActiveFedora::Predicates.predicate_mappings['http://fedora.info/definitions/v4/rels-ext#'].length).to eq 1
49
49
  end
50
50
 
51
51
  end
@@ -1,19 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::Config do
4
- describe "with a single fedora instance" do
5
- conf = Psych.load(File.read('spec/fixtures/rails_root/config/fedora.yml'))['test']
6
- subject { ActiveFedora::Config.new(conf) }
7
- its(:credentials) { should == {:url => 'http://testhost.com:8983/fedora', :user=> 'fedoraAdmin', :password=> 'fedoraAdmin'}}
8
- it { is_expected.not_to be_sharded }
9
- end
10
- describe "with several fedora shards" do
11
- conf = Psych.load(File.read('spec/fixtures/sharded_fedora.yml'))['test']
12
- subject { ActiveFedora::Config.new(conf) }
13
- its(:credentials) { should == [{:url => 'http://127.0.0.1:8983/fedora1', :user=> 'fedoraAdmin', :password=> 'fedoraAdmin'},
14
- {:url => 'http://127.0.0.1:8983/fedora2', :user=> 'fedoraAdmin', :password=> 'fedoraAdmin'},
15
- {:url => 'http://127.0.0.1:8983/fedora3', :user=> 'fedoraAdmin', :password=> 'fedoraAdmin'}]}
16
- it { is_expected.to be_sharded }
17
- end
4
+ context "with a single fedora instance" do
5
+ let(:yaml) { Psych.load(File.read('spec/fixtures/rails_root/config/fedora.yml'))['test'] }
6
+ let(:conf) { ActiveFedora::Config.new(yaml) }
18
7
 
8
+ describe "#credentials" do
9
+ subject { conf.credentials }
10
+ it { should eq(url: 'http://testhost.com:8983/fedora', user: 'fedoraAdmin', password: 'fedoraAdmin') }
11
+ end
12
+
13
+ end
19
14
  end
@@ -3,12 +3,12 @@ require 'spec_helper'
3
3
  describe ActiveFedora::Base do
4
4
  before do
5
5
  class MyDatastream < ActiveFedora::NtriplesRDFDatastream
6
- property :publisher, :predicate => RDF::DC.publisher
6
+ property :publisher, predicate: ::RDF::DC.publisher
7
7
  end
8
8
  class Library < ActiveFedora::Base
9
9
  end
10
10
  class Book < ActiveFedora::Base
11
- belongs_to :library, property: :has_constituent
11
+ belongs_to :library, predicate: ActiveFedora::RDF::RelsExt.hasConstituent
12
12
  has_metadata "foo", type: ActiveFedora::SimpleDatastream do |m|
13
13
  m.field "title", :string
14
14
  end
@@ -16,15 +16,30 @@ describe ActiveFedora::Base do
16
16
  has_attributes :title, datastream: 'foo' # Om backed property
17
17
  has_attributes :publisher, datastream: 'bar' # RDF backed property
18
18
  end
19
- subject.library = library
20
19
  end
20
+
21
21
  let (:library) { Library.create }
22
- subject {Book.new(library: library, title: "War and Peace", publisher: "Random House")}
23
- after do
22
+ subject { Book.new(library: library, title: "War and Peace", publisher: "Random House") }
23
+
24
+ after do
24
25
  Object.send(:remove_const, :Book)
25
26
  Object.send(:remove_const, :Library)
27
+ Object.send(:remove_const, :MyDatastream)
28
+ end
29
+
30
+ it "should assert a content model" do
31
+ expect(subject.has_model).to eq ['Book']
26
32
  end
27
33
 
34
+ describe "initialize with a block" do
35
+ subject { Book.new { |b| b.title= "The Sun also Rises" } }
36
+
37
+ it "should have set the title" do
38
+ expect(subject.title).to eq "The Sun also Rises"
39
+ end
40
+ end
41
+
42
+
28
43
  describe "#freeze" do
29
44
  before { subject.freeze }
30
45
 
@@ -34,9 +49,9 @@ describe ActiveFedora::Base do
34
49
 
35
50
  it "should make the associations immutable" do
36
51
  expect {
37
- subject.library_id = Library.create!.pid
52
+ subject.library_id = Library.create!.id
38
53
  }.to raise_error RuntimeError, "can't modify frozen Book"
39
- expect(subject.library_id).to eq library.pid
54
+ expect(subject.library_id).to eq library.id
40
55
  end
41
56
 
42
57
  describe "when the association is set via an id" do
@@ -68,8 +83,44 @@ describe ActiveFedora::Base do
68
83
  it "should access associations" do
69
84
  f = Book.find(subject.id)
70
85
  f.freeze
71
- expect(f.library_id).not_to be_nil
86
+ expect(f.library_id).to_not be_nil
87
+
88
+ end
89
+ end
90
+
91
+ describe "id_to_uri" do
92
+ let(:id) { '123456w' }
93
+ subject { ActiveFedora::Base.id_to_uri(id) }
94
+
95
+ context "with no custom proc is set" do
96
+ it { should eq "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/123456w" }
97
+ end
98
+
99
+ context "when custom proc is set" do
100
+ before do
101
+ ActiveFedora::Base.translate_id_to_uri = lambda { |id| "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/foo/#{id}" }
102
+ end
103
+ after { ActiveFedora::Base.translate_id_to_uri = nil }
104
+
105
+ it { should eq "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/foo/123456w" }
106
+ end
107
+ end
108
+
109
+ describe "uri_to_id" do
110
+ let(:uri) { "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/foo/123456w" }
111
+ subject { ActiveFedora::Base.uri_to_id(uri) }
112
+
113
+ context "with no custom proc is set" do
114
+ it { should eq 'foo/123456w' }
115
+ end
116
+
117
+ context "when custom proc is set" do
118
+ before do
119
+ ActiveFedora::Base.translate_uri_to_id = lambda { |uri| uri.to_s.split('/')[-1] }
120
+ end
121
+ after { ActiveFedora::Base.translate_uri_to_id = nil }
72
122
 
123
+ it { should eq '123456w' }
73
124
  end
74
125
  end
75
126
  end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
  require 'config_helper'
3
3
 
4
4
  describe ActiveFedora::FileConfigurator do
5
-
5
+
6
6
  subject {ActiveFedora.configurator }
7
-
7
+
8
8
  after :all do
9
9
  unstub_rails
10
10
  # Restore to default fedora configs
@@ -15,7 +15,7 @@ describe ActiveFedora::FileConfigurator do
15
15
  it "should trigger configuration reset (to empty defaults)" do
16
16
  expect_any_instance_of(ActiveFedora::FileConfigurator).to receive(:reset!)
17
17
  ActiveFedora::FileConfigurator.new
18
- end
18
+ end
19
19
  end
20
20
 
21
21
  describe "#config_options" do
@@ -34,7 +34,7 @@ describe ActiveFedora::FileConfigurator do
34
34
  it "should trigger configuration to load" do
35
35
  expect(subject).to receive(:load_fedora_config)
36
36
  subject.fedora_config
37
- end
37
+ end
38
38
  end
39
39
  describe "#solr_config" do
40
40
  before do
@@ -43,16 +43,16 @@ describe ActiveFedora::FileConfigurator do
43
43
  it "should trigger configuration to load" do
44
44
  expect(subject).to receive(:load_solr_config)
45
45
  subject.solr_config
46
- end
46
+ end
47
47
  end
48
48
 
49
49
  describe "#reset!" do
50
50
  before { subject.reset! }
51
51
  it "should clear @fedora_config" do
52
- expect(subject.instance_variable_get(:@fedora_config)).to eq({})
52
+ expect(subject.instance_variable_get(:@fedora_config)).to eq({})
53
53
  end
54
54
  it "should clear @solr_config" do
55
- expect(subject.instance_variable_get(:@solr_config)).to eq({})
55
+ expect(subject.instance_variable_get(:@solr_config)).to eq({})
56
56
  end
57
57
  it "should clear @config_options" do
58
58
  expect(subject.instance_variable_get(:@config_options)).to eq({})
@@ -60,7 +60,7 @@ describe ActiveFedora::FileConfigurator do
60
60
  end
61
61
 
62
62
  describe "initialization methods" do
63
-
63
+
64
64
  describe "get_config_path(:fedora)" do
65
65
  it "should use the config_options[:config_path] if it exists" do
66
66
  expect(subject).to receive(:config_options).and_return({:fedora_config_path => "/path/to/fedora.yml"})
@@ -78,7 +78,7 @@ describe ActiveFedora::FileConfigurator do
78
78
 
79
79
  it "should look in ./config/fedora.yml if neither rails.root nor :fedora_config_path are set" do
80
80
  expect(subject).to receive(:config_options).and_return({})
81
- allow(Dir).to receive_messages(:getwd => "/current/working/directory")
81
+ allow(Dir).to receive(:getwd).and_return("/current/working/directory")
82
82
  expect(File).to receive(:file?).with("/current/working/directory/config/fedora.yml").and_return(true)
83
83
  expect(subject.get_config_path(:fedora)).to eql("/current/working/directory/config/fedora.yml")
84
84
  end
@@ -110,7 +110,7 @@ describe ActiveFedora::FileConfigurator do
110
110
 
111
111
  it "should look in ./config/predicate_mappings.yml if neither rails.root nor :predicate_mappings_config_path are set" do
112
112
  expect(subject).to receive(:config_options).and_return({})
113
- allow(Dir).to receive_messages(:getwd => "/current/working/directory")
113
+ allow(Dir).to receive(:getwd).and_return("/current/working/directory")
114
114
  expect(File).to receive(:file?).with("/current/working/directory/config/predicate_mappings.yml").and_return(true)
115
115
  expect(subject.get_config_path(:predicate_mappings)).to eql("/current/working/directory/config/predicate_mappings.yml")
116
116
  end
@@ -127,21 +127,21 @@ describe ActiveFedora::FileConfigurator do
127
127
 
128
128
  describe "get_config_path(:solr)" do
129
129
  it "should return the solr_config_path if set in config_options hash" do
130
- allow(subject).to receive_messages(:config_options => {:solr_config_path => "/path/to/solr.yml"})
130
+ allow(subject).to receive(:config_options).and_return(:solr_config_path => "/path/to/solr.yml")
131
131
  expect(File).to receive(:file?).with("/path/to/solr.yml").and_return(true)
132
132
  expect(subject.get_config_path(:solr)).to eql("/path/to/solr.yml")
133
133
  end
134
-
134
+
135
135
  it "should return the solr.yml file in the same directory as the fedora.yml if it exists" do
136
136
  expect(subject).to receive(:path).and_return("/path/to/fedora/config/fedora.yml")
137
137
  expect(File).to receive(:file?).with("/path/to/fedora/config/solr.yml").and_return(true)
138
138
  expect(subject.get_config_path(:solr)).to eql("/path/to/fedora/config/solr.yml")
139
139
  end
140
-
140
+
141
141
  context "no solr.yml in same directory as fedora.yml and fedora.yml does not contain solr url" do
142
142
 
143
143
  before :each do
144
- allow(subject).to receive_messages(:config_options => {})
144
+ allow(subject).to receive(:config_options).and_return({})
145
145
  expect(subject).to receive(:path).and_return("/path/to/fedora/config/fedora.yml")
146
146
  expect(File).to receive(:file?).with("/path/to/fedora/config/solr.yml").and_return(false)
147
147
  end
@@ -156,13 +156,13 @@ describe ActiveFedora::FileConfigurator do
156
156
  end
157
157
 
158
158
  it "should look in ./config/solr.yml if no rails root" do
159
- allow(Dir).to receive_messages(:getwd => "/current/working/directory")
159
+ allow(Dir).to receive(:getwd).and_return("/current/working/directory")
160
160
  expect(File).to receive(:file?).with("/current/working/directory/config/solr.yml").and_return(true)
161
161
  expect(subject.get_config_path(:solr)).to eql("/current/working/directory/config/solr.yml")
162
162
  end
163
163
 
164
164
  it "should return the default solr.yml file that ships with active-fedora if no other option is set" do
165
- allow(Dir).to receive_messages(:getwd => "/current/working/directory")
165
+ allow(Dir).to receive(:getwd).and_return("/current/working/directory")
166
166
  expect(File).to receive(:file?).with("/current/working/directory/config/solr.yml").and_return(false)
167
167
  expect(File).to receive(:file?).with(File.expand_path(File.join(File.dirname("__FILE__"),'config','solr.yml'))).and_return(true)
168
168
  expect(ActiveFedora::Base.logger).to receive(:warn).with("Using the default solr.yml that comes with active-fedora. If you want to override this, pass the path to solr.yml to ActiveFedora - ie. ActiveFedora.init(:solr_config_path => '/path/to/solr.yml') - or set Rails.root and put solr.yml into \#{Rails.root}/config.")
@@ -181,8 +181,8 @@ describe ActiveFedora::FileConfigurator do
181
181
  expect(subject).to receive(:get_config_path).with(:fedora).and_return("/path/to/fedora.yml")
182
182
  expect(subject).to receive(:load_solr_config)
183
183
  expect(IO).to receive(:read).with("/path/to/fedora.yml").and_return("development:\n url: http://devfedora:8983\ntest:\n url: http://myfedora:8080")
184
- expect(subject.load_fedora_config).to eq({:url=>"http://myfedora:8080"})
185
- expect(subject.fedora_config).to eq({:url=>"http://myfedora:8080"})
184
+ expect(subject.load_fedora_config).to eq(:url=>"http://myfedora:8080")
185
+ expect(subject.fedora_config).to eq(:url=>"http://myfedora:8080")
186
186
  end
187
187
 
188
188
  it "should allow sharding" do
@@ -190,8 +190,8 @@ describe ActiveFedora::FileConfigurator do
190
190
  expect(subject).to receive(:get_config_path).with(:fedora).and_return("/path/to/fedora.yml")
191
191
  expect(subject).to receive(:load_solr_config)
192
192
  expect(IO).to receive(:read).with("/path/to/fedora.yml").and_return("development:\n url: http://devfedora:8983\ntest:\n- url: http://myfedora:8080\n- url: http://myfedora:8081")
193
- expect(subject.load_fedora_config).to eq([{:url=>"http://myfedora:8080"}, {:url=>"http://myfedora:8081"}])
194
- expect(subject.fedora_config).to eq([{:url=>"http://myfedora:8080"}, {:url=>"http://myfedora:8081"}])
193
+ expect(subject.load_fedora_config).to eq [{:url=>"http://myfedora:8080"}, {:url=>"http://myfedora:8081"}]
194
+ expect(subject.fedora_config).to eq [{:url=>"http://myfedora:8080"}, {:url=>"http://myfedora:8081"}]
195
195
  end
196
196
 
197
197
  it "should parse the file using ERb" do
@@ -199,8 +199,8 @@ describe ActiveFedora::FileConfigurator do
199
199
  expect(subject).to receive(:get_config_path).with(:fedora).and_return("/path/to/fedora.yml")
200
200
  expect(subject).to receive(:load_solr_config)
201
201
  expect(IO).to receive(:read).with("/path/to/fedora.yml").and_return("development:\n url: http://devfedora:<%= 8983 %>\ntest:\n url: http://myfedora:<%= 8081 %>")
202
- expect(subject.load_fedora_config).to eq({:url=>"http://myfedora:8081"})
203
- expect(subject.fedora_config).to eq({:url=>"http://myfedora:8081"})
202
+ expect(subject.load_fedora_config).to eq(:url=>"http://myfedora:8081")
203
+ expect(subject.fedora_config).to eq(:url=>"http://myfedora:8081")
204
204
  end
205
205
  end
206
206
 
@@ -213,8 +213,8 @@ describe ActiveFedora::FileConfigurator do
213
213
  expect(subject).to receive(:get_config_path).with(:solr).and_return("/path/to/solr.yml")
214
214
  expect(subject).to receive(:load_fedora_config)
215
215
  expect(IO).to receive(:read).with("/path/to/solr.yml").and_return("development:\n default:\n url: http://devsolr:8983\ntest:\n default:\n url: http://mysolr:8080")
216
- expect(subject.load_solr_config).to eq({:url=>"http://mysolr:8080"})
217
- expect(subject.solr_config).to eq({:url=>"http://mysolr:8080"})
216
+ expect(subject.load_solr_config).to eq(:url=>"http://mysolr:8080")
217
+ expect(subject.solr_config).to eq(:url=>"http://mysolr:8080")
218
218
  end
219
219
 
220
220
  it "should parse the file using ERb" do
@@ -222,8 +222,8 @@ describe ActiveFedora::FileConfigurator do
222
222
  expect(subject).to receive(:get_config_path).with(:solr).and_return("/path/to/solr.yml")
223
223
  expect(subject).to receive(:load_fedora_config)
224
224
  expect(IO).to receive(:read).with("/path/to/solr.yml").and_return("development:\n default:\n url: http://devsolr:<%= 8983 %>\ntest:\n default:\n url: http://mysolr:<%= 8081 %>")
225
- expect(subject.load_solr_config).to eq({:url=>"http://mysolr:8081"})
226
- expect(subject.solr_config).to eq({:url=>"http://mysolr:8081"})
225
+ expect(subject.load_solr_config).to eq(:url=>"http://mysolr:8081")
226
+ expect(subject.solr_config).to eq(:url=>"http://mysolr:8081")
227
227
  end
228
228
  end
229
229
 
@@ -233,9 +233,9 @@ describe ActiveFedora::FileConfigurator do
233
233
  subject.instance_variable_set :@config_loaded, nil
234
234
  end
235
235
  it "should load the fedora and solr configs" do
236
- expect(subject.config_loaded?).to be_falsey
236
+ expect(subject).to_not be_config_loaded
237
237
  subject.load_configs
238
- expect(subject.config_loaded?).to be_truthy
238
+ expect(subject).to be_config_loaded
239
239
  end
240
240
  end
241
241
  describe "when config is loaded" do
@@ -244,9 +244,9 @@ describe ActiveFedora::FileConfigurator do
244
244
  end
245
245
  it "should load the fedora and solr configs" do
246
246
  expect(subject).to receive(:load_config).never
247
- expect(subject.config_loaded?).to be_truthy
247
+ expect(subject).to be_config_loaded
248
248
  subject.load_configs
249
- expect(subject.config_loaded?).to be_truthy
249
+ expect(subject).to be_config_loaded
250
250
  end
251
251
  end
252
252
  end
@@ -255,7 +255,7 @@ describe ActiveFedora::FileConfigurator do
255
255
  it "should find the solr.yml file and return it if it exists" do
256
256
  expect(subject).to receive(:path).and_return("/path/to/fedora/fedora.yml")
257
257
  expect(File).to receive(:file?).with("/path/to/fedora/solr.yml").and_return(true)
258
- expect(subject.check_fedora_path_for_solr).to eq("/path/to/fedora/solr.yml")
258
+ expect(subject.check_fedora_path_for_solr).to eq "/path/to/fedora/solr.yml"
259
259
  end
260
260
  it "should return nil if the solr.yml file is not there" do
261
261
  expect(subject).to receive(:path).and_return("/path/to/fedora/fedora.yml")
@@ -264,24 +264,25 @@ describe ActiveFedora::FileConfigurator do
264
264
  end
265
265
  end
266
266
  end
267
-
267
+
268
268
  describe "setting the environment and loading configuration" do
269
-
269
+
270
270
  before(:all) do
271
271
  @fake_rails_root = File.expand_path(File.dirname(__FILE__) + '/../fixtures/rails_root')
272
272
  end
273
273
 
274
-
274
+
275
275
  after(:all) do
276
276
  config_file = File.join(File.dirname(__FILE__), "..", "..", "config", "fedora.yml")
277
277
  environment = "test"
278
278
  ActiveFedora.init(:environment=>environment, :fedora_config_path=>config_file)
279
279
  end
280
-
280
+
281
281
  it "can tell its config paths" do
282
282
  subject.init
283
283
  expect(subject).to respond_to(:solr_config_path)
284
284
  end
285
+
285
286
  it "loads a config from the current working directory as a second choice" do
286
287
  allow(subject).to receive(:load_solrizer_config)
287
288
  allow(Dir).to receive(:getwd).and_return(@fake_rails_root)
@@ -289,6 +290,7 @@ describe ActiveFedora::FileConfigurator do
289
290
  expect(subject.get_config_path(:fedora)).to eql("#{@fake_rails_root}/config/fedora.yml")
290
291
  expect(subject.solr_config_path).to eql("#{@fake_rails_root}/config/solr.yml")
291
292
  end
293
+
292
294
  it "loads the config that ships with this gem as a last choice" do
293
295
  allow(Dir).to receive(:getwd).and_return("/fake/path")
294
296
  allow(subject).to receive(:load_solrizer_config)
@@ -299,42 +301,42 @@ describe ActiveFedora::FileConfigurator do
299
301
  expect(subject.solr_config_path).to eql(expected_config+'/solr.yml')
300
302
  end
301
303
  it "raises an error if you pass in a string" do
302
- expect{ subject.init("#{@fake_rails_root}/config/fake_fedora.yml") }.to raise_exception(ArgumentError)
304
+ expect(lambda{ subject.init("#{@fake_rails_root}/config/fake_fedora.yml") }).to raise_exception(ArgumentError)
303
305
  end
304
306
  it "raises an error if you pass in a non-existant config file" do
305
- expect{ subject.init(:fedora_config_path=>"really_fake_fedora.yml") }.to raise_exception(ActiveFedora::ConfigurationError)
307
+ expect(lambda{ subject.init(:fedora_config_path=>"really_fake_fedora.yml") }).to raise_exception(ActiveFedora::ConfigurationError)
306
308
  end
307
-
309
+
308
310
  describe "within Rails" do
309
- before(:all) do
311
+ before do
310
312
  stub_rails(:root=>File.dirname(__FILE__) + '/../fixtures/rails_root')
311
313
  end
312
314
 
313
- after(:all) do
315
+ after do
314
316
  unstub_rails
315
317
  end
316
-
318
+
317
319
  it "loads a config from Rails.root as a first choice" do
318
320
  allow(subject).to receive(:load_solrizer_config)
319
321
  subject.init
320
322
  expect(subject.get_config_path(:fedora)).to eql("#{Rails.root}/config/fedora.yml")
321
323
  expect(subject.solr_config_path).to eql("#{Rails.root}/config/solr.yml")
322
324
  end
323
-
325
+
324
326
  it "can tell what environment it is set to run in" do
325
327
  stub_rails(:env=>"development")
326
328
  subject.init
327
329
  expect(ActiveFedora.environment).to eql("development")
328
330
  end
329
-
331
+
330
332
  end
331
333
  end
332
-
334
+
333
335
  ##########################
334
-
336
+
335
337
  describe ".build_predicate_config_path" do
336
338
  it "should return the path to the default config/predicate_mappings.yml if no valid path is given" do
337
- expect(subject.send(:build_predicate_config_path)).to eq(default_predicate_mapping_file)
339
+ expect(subject.send(:build_predicate_config_path)).to eq default_predicate_mapping_file
338
340
  end
339
341
  end
340
342
 
@@ -343,29 +345,29 @@ describe ActiveFedora::FileConfigurator do
343
345
  subject.instance_variable_set :@config_loaded, nil
344
346
  end
345
347
  it "should return the default mapping if it has not been initialized" do
346
- expect(subject.predicate_config()).to eq(Psych.load(File.read(default_predicate_mapping_file)))
348
+ expect(subject.predicate_config()).to eq Psych.load(File.read(default_predicate_mapping_file))
347
349
  end
348
350
  end
349
351
 
350
352
  describe ".valid_predicate_mapping" do
351
353
  it "should return true if the predicate mapping has the appropriate keys and value types" do
352
- expect(subject.send(:valid_predicate_mapping?,default_predicate_mapping_file)).to be_truthy
354
+ expect(subject.send(:valid_predicate_mapping?, default_predicate_mapping_file)).to be true
353
355
  end
354
356
  it "should return false if the mapping is missing the :default_namespace" do
355
- mock_yaml({:default_namespace0=>"my_namespace",:predicate_mapping=>{:key0=>"value0", :key1=>"value1"}},"/path/to/predicate_mappings.yml")
356
- expect(subject.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml")).to be_falsey
357
+ mock_yaml({:default_namespace0=>"my_namespace", :predicate_mapping=>{:key0=>"value0", :key1=>"value1"}},"/path/to/predicate_mappings.yml")
358
+ expect(subject.send(:valid_predicate_mapping?, "/path/to/predicate_mappings.yml")).to be false
357
359
  end
358
360
  it "should return false if the :default_namespace is not a string" do
359
361
  mock_yaml({:default_namespace=>{:foo=>"bar"}, :predicate_mapping=>{:key0=>"value0", :key1=>"value1"}},"/path/to/predicate_mappings.yml")
360
- expect(subject.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml")).to be_falsey
362
+ expect(subject.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml")).to be false
361
363
  end
362
364
  it "should return false if the :predicate_mappings key is missing" do
363
365
  mock_yaml({:default_namespace=>"a string"},"/path/to/predicate_mappings.yml")
364
- expect(subject.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml")).to be_falsey
366
+ expect(subject.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml")).to be false
365
367
  end
366
368
  it "should return false if the :predicate_mappings key is not a hash" do
367
369
  mock_yaml({:default_namespace=>"a string",:predicate_mapping=>"another string"},"/path/to/predicate_mappings.yml")
368
- expect(subject.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml")).to be_falsey
370
+ expect(subject.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml")).to be false
369
371
  end
370
372
 
371
373
  end