active-fedora 10.0.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +6 -7
  4. data/.rubocop_todo.yml +55 -0
  5. data/.solr_wrapper +6 -0
  6. data/README.md +1 -3
  7. data/active-fedora.gemspec +6 -11
  8. data/lib/active_fedora/aggregation/list_source.rb +2 -0
  9. data/lib/active_fedora/associations/association_scope.rb +1 -1
  10. data/lib/active_fedora/associations/builder/aggregation.rb +1 -1
  11. data/lib/active_fedora/associations/builder/association.rb +1 -1
  12. data/lib/active_fedora/associations/builder/orders.rb +11 -3
  13. data/lib/active_fedora/associations/collection_association.rb +3 -3
  14. data/lib/active_fedora/associations/contained_finder.rb +2 -2
  15. data/lib/active_fedora/associations/has_many_association.rb +2 -2
  16. data/lib/active_fedora/associations/has_subresource_association.rb +2 -2
  17. data/lib/active_fedora/associations/orders_association.rb +4 -0
  18. data/lib/active_fedora/associations/rdf.rb +2 -0
  19. data/lib/active_fedora/attribute_assignment.rb +0 -1
  20. data/lib/active_fedora/attribute_methods/dirty.rb +1 -1
  21. data/lib/active_fedora/attributes.rb +1 -1
  22. data/lib/active_fedora/base.rb +4 -8
  23. data/lib/active_fedora/change_set.rb +6 -2
  24. data/lib/active_fedora/containers/container.rb +1 -1
  25. data/lib/active_fedora/core.rb +22 -25
  26. data/lib/active_fedora/fedora_attributes.rb +1 -1
  27. data/lib/active_fedora/file/streaming.rb +1 -1
  28. data/lib/active_fedora/file.rb +1 -9
  29. data/lib/active_fedora/indexing.rb +0 -15
  30. data/lib/active_fedora/indexing_service.rb +0 -9
  31. data/lib/active_fedora/loadable_from_json.rb +12 -1
  32. data/lib/active_fedora/nested_attributes.rb +2 -2
  33. data/lib/active_fedora/orders/list_node.rb +2 -2
  34. data/lib/active_fedora/orders/ordered_list.rb +7 -3
  35. data/lib/active_fedora/orders/target_proxy.rb +4 -0
  36. data/lib/active_fedora/querying.rb +1 -1
  37. data/lib/active_fedora/railtie.rb +2 -2
  38. data/lib/active_fedora/rake_support.rb +1 -1
  39. data/lib/active_fedora/rdf/persistence.rb +1 -0
  40. data/lib/active_fedora/rdf.rb +0 -2
  41. data/lib/active_fedora/relation/delegation.rb +4 -0
  42. data/lib/active_fedora/relation/finder_methods.rb +3 -3
  43. data/lib/active_fedora/scoping/named.rb +1 -0
  44. data/lib/active_fedora/solr_hit.rb +0 -13
  45. data/lib/active_fedora/solr_query_builder.rb +24 -13
  46. data/lib/active_fedora/version.rb +1 -1
  47. data/lib/active_fedora.rb +0 -12
  48. data/lib/generators/active_fedora/config/solr/templates/solr/config/solrconfig.xml +11 -0
  49. data/lib/generators/active_fedora/config/solr/templates/solr_wrapper_test.yml +1 -1
  50. data/lib/generators/active_fedora/model/model_generator.rb +1 -1
  51. data/lib/generators/active_fedora/model/templates/model.rb.erb +4 -4
  52. data/lib/tasks/active_fedora_dev.rake +1 -9
  53. data/spec/config_helper.rb +1 -1
  54. data/spec/integration/associations_spec.rb +23 -24
  55. data/spec/integration/attached_files_spec.rb +18 -8
  56. data/spec/integration/attributes_spec.rb +12 -16
  57. data/spec/integration/autosave_association_spec.rb +6 -6
  58. data/spec/integration/base_spec.rb +3 -3
  59. data/spec/integration/basic_contains_association_spec.rb +1 -1
  60. data/spec/integration/clean_connection_spec.rb +1 -1
  61. data/spec/integration/collection_association_spec.rb +2 -5
  62. data/spec/integration/date_time_properties_spec.rb +1 -16
  63. data/spec/integration/direct_container_spec.rb +12 -12
  64. data/spec/integration/directly_contains_one_association_spec.rb +11 -13
  65. data/spec/integration/eradicate_spec.rb +1 -1
  66. data/spec/integration/fedora_solr_sync_spec.rb +2 -2
  67. data/spec/integration/file_fixity_spec.rb +6 -8
  68. data/spec/integration/file_spec.rb +32 -34
  69. data/spec/integration/generators/solr_generator_spec.rb +7 -10
  70. data/spec/integration/has_and_belongs_to_many_associations_spec.rb +5 -5
  71. data/spec/integration/has_many_associations_spec.rb +9 -11
  72. data/spec/integration/indexing_spec.rb +2 -2
  73. data/spec/integration/indirect_container_spec.rb +11 -12
  74. data/spec/integration/json_serialization_spec.rb +4 -4
  75. data/spec/integration/query_result_builder_spec.rb +9 -21
  76. data/spec/integration/rdf_nested_attributes_spec.rb +7 -7
  77. data/spec/integration/relation_delegation_spec.rb +8 -10
  78. data/spec/integration/relation_spec.rb +13 -16
  79. data/spec/integration/scoped_query_spec.rb +4 -3
  80. data/spec/integration/solr_hit_spec.rb +4 -15
  81. data/spec/integration/versionable_spec.rb +73 -327
  82. data/spec/integration/with_metadata_spec.rb +1 -1
  83. data/spec/spec_helper.rb +52 -4
  84. data/spec/unit/active_fedora_spec.rb +1 -1
  85. data/spec/unit/aggregation/list_source_spec.rb +37 -37
  86. data/spec/unit/aggregation/ordered_reader_spec.rb +4 -4
  87. data/spec/unit/association_hash_spec.rb +17 -31
  88. data/spec/unit/attached_files_spec.rb +35 -32
  89. data/spec/unit/attributes_spec.rb +25 -25
  90. data/spec/unit/base_active_model_spec.rb +8 -8
  91. data/spec/unit/base_cma_spec.rb +1 -1
  92. data/spec/unit/base_extra_spec.rb +7 -22
  93. data/spec/unit/base_spec.rb +16 -22
  94. data/spec/unit/callback_spec.rb +2 -2
  95. data/spec/unit/change_set_spec.rb +5 -5
  96. data/spec/unit/checksum_spec.rb +2 -2
  97. data/spec/unit/code_configurator_spec.rb +1 -1
  98. data/spec/unit/core_spec.rb +62 -26
  99. data/spec/unit/default_model_mapper_spec.rb +6 -6
  100. data/spec/unit/fedora_spec.rb +3 -4
  101. data/spec/unit/file_configurator_spec.rb +96 -96
  102. data/spec/unit/file_path_builder_spec.rb +1 -1
  103. data/spec/unit/file_spec.rb +61 -61
  104. data/spec/unit/files_hash_spec.rb +9 -9
  105. data/spec/unit/filter_spec.rb +3 -3
  106. data/spec/unit/finder_methods_spec.rb +5 -5
  107. data/spec/unit/forbidden_attributes_protection_spec.rb +2 -2
  108. data/spec/unit/has_and_belongs_to_many_association_spec.rb +14 -15
  109. data/spec/unit/has_many_association_spec.rb +28 -13
  110. data/spec/unit/indexers/global_indexer_spec.rb +6 -6
  111. data/spec/unit/indexing_service_spec.rb +5 -5
  112. data/spec/unit/indexing_spec.rb +6 -6
  113. data/spec/unit/inheritance_spec.rb +11 -7
  114. data/spec/unit/loadable_from_json_spec.rb +4 -4
  115. data/spec/unit/logger_spec.rb +1 -1
  116. data/spec/unit/model_classifier_spec.rb +5 -5
  117. data/spec/unit/ordered_spec.rb +144 -146
  118. data/spec/unit/orders/list_node_spec.rb +22 -22
  119. data/spec/unit/orders/ordered_list_spec.rb +96 -96
  120. data/spec/unit/orders/reflection_spec.rb +4 -4
  121. data/spec/unit/pathing_spec.rb +4 -4
  122. data/spec/unit/persistence_spec.rb +28 -28
  123. data/spec/unit/property_spec.rb +2 -2
  124. data/spec/unit/query_spec.rb +20 -20
  125. data/spec/unit/rdf/indexing_service_spec.rb +29 -29
  126. data/spec/unit/readonly_spec.rb +5 -4
  127. data/spec/unit/reflection_spec.rb +3 -3
  128. data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +9 -9
  129. data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +9 -9
  130. data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +9 -9
  131. data/spec/unit/schema_indexing_strategy_spec.rb +5 -5
  132. data/spec/unit/serializers_spec.rb +3 -4
  133. data/spec/unit/solr_config_options_spec.rb +13 -16
  134. data/spec/unit/solr_hit_spec.rb +9 -9
  135. data/spec/unit/solr_service_spec.rb +4 -10
  136. data/spec/unit/sparql_insert_spec.rb +2 -2
  137. data/spec/unit/validations_spec.rb +9 -9
  138. data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +3 -2
  139. data/spec/unit/with_metadata/metadata_node_spec.rb +3 -2
  140. metadata +18 -122
  141. data/lib/active_fedora/datastreams/nokogiri_datastreams.rb +0 -119
  142. data/lib/active_fedora/datastreams.rb +0 -6
  143. data/lib/active_fedora/nom_datastream.rb +0 -67
  144. data/lib/active_fedora/om_datastream.rb +0 -126
  145. data/lib/active_fedora/profile_indexing_service.rb +0 -11
  146. data/lib/active_fedora/qualified_dublin_core_datastream.rb +0 -158
  147. data/lib/active_fedora/rdf/datastream_indexing.rb +0 -43
  148. data/lib/active_fedora/rdf/ntriples_rdf_datastream.rb +0 -9
  149. data/lib/active_fedora/rdf/rdf_datastream.rb +0 -158
  150. data/lib/active_fedora/rdf/rdfxml_datastream.rb +0 -13
  151. data/lib/active_fedora/solr_instance_loader.rb +0 -47
  152. data/solr/config/_rest_managed.json +0 -3
  153. data/solr/config/admin-extra.html +0 -31
  154. data/solr/config/elevate.xml +0 -36
  155. data/solr/config/mapping-ISOLatin1Accent.txt +0 -246
  156. data/solr/config/protwords.txt +0 -21
  157. data/solr/config/schema.xml +0 -372
  158. data/solr/config/scripts.conf +0 -24
  159. data/solr/config/solrconfig.xml +0 -311
  160. data/solr/config/spellings.txt +0 -2
  161. data/solr/config/stopwords.txt +0 -58
  162. data/solr/config/stopwords_en.txt +0 -58
  163. data/solr/config/synonyms.txt +0 -31
  164. data/solr/config/xslt/example.xsl +0 -132
  165. data/solr/config/xslt/example_atom.xsl +0 -67
  166. data/solr/config/xslt/example_rss.xsl +0 -66
  167. data/solr/config/xslt/luke.xsl +0 -337
  168. data/spec/fixtures/damsObjectModel.xml +0 -38
  169. data/spec/fixtures/dublin_core_rdf_descMetadata.nt +0 -13
  170. data/spec/fixtures/mixed_rdf_descMetadata.nt +0 -7
  171. data/spec/fixtures/mods_articles/mods_article1.xml +0 -98
  172. data/spec/fixtures/solr_rdf_descMetadata.nt +0 -7
  173. data/spec/integration/complex_rdf_datastream_spec.rb +0 -228
  174. data/spec/integration/datastream_rdf_nested_attributes_spec.rb +0 -179
  175. data/spec/integration/ntriples_datastream_spec.rb +0 -203
  176. data/spec/integration/om_datastream_spec.rb +0 -78
  177. data/spec/integration/solr_instance_loader_spec.rb +0 -155
  178. data/spec/samples/hydra-mods_article_datastream.rb +0 -517
  179. data/spec/samples/models/mods_article.rb +0 -9
  180. data/spec/samples/oral_history_sample.xml +0 -38
  181. data/spec/samples/oral_history_xml.xml +0 -35
  182. data/spec/samples/samples.rb +0 -2
  183. data/spec/unit/nom_datastream_spec.rb +0 -60
  184. data/spec/unit/ntriples_datastream_spec.rb +0 -170
  185. data/spec/unit/om_datastream_spec.rb +0 -325
  186. data/spec/unit/qualified_dublin_core_datastream_spec.rb +0 -119
  187. data/spec/unit/rdf_datastream_spec.rb +0 -84
  188. data/spec/unit/rdf_resource_datastream_spec.rb +0 -204
  189. data/spec/unit/rdfxml_datastream_spec.rb +0 -106
@@ -130,18 +130,17 @@ describe "Indirect containers" do
130
130
  end
131
131
 
132
132
  describe "#first" do
133
- subject { reloaded.related_objects.first }
133
+ subject(:first) { reloaded.related_objects.first }
134
134
  it "has the content" do
135
- expect(subject.title).to eq 'HMMM'
135
+ expect(first.title).to eq 'HMMM'
136
136
  end
137
137
  end
138
138
 
139
139
  describe "#==" do
140
140
  subject { reloaded.related_objects }
141
141
 
142
- it "delegates to to_a" do
143
- expect(subject).to eq [file]
144
- end
142
+ # it delegates to to_a
143
+ it { is_expected.to eq [file] }
145
144
  end
146
145
 
147
146
  describe "#concat" do
@@ -160,7 +159,7 @@ describe "Indirect containers" do
160
159
  describe "#append" do
161
160
  let(:file2) { o.related_objects.build }
162
161
  it "has two related_objects" do
163
- expect(o.related_objects).to eq [file, file2]
162
+ expect(o.related_objects).to contain_exactly file, file2
164
163
  end
165
164
 
166
165
  context "and then saved/reloaded" do
@@ -170,7 +169,7 @@ describe "Indirect containers" do
170
169
  end
171
170
 
172
171
  it "has two related_objects" do
173
- expect(reloaded.related_objects).to eq [file, file2]
172
+ expect(reloaded.related_objects).to contain_exactly file, file2
174
173
  end
175
174
  end
176
175
  end
@@ -196,7 +195,7 @@ describe "Indirect containers" do
196
195
  end
197
196
 
198
197
  it "returns the ids" do
199
- expect(reloaded.related_object_ids).to eq [file.id, file2.id]
198
+ expect(reloaded.related_object_ids).to contain_exactly file.id, file2.id
200
199
  end
201
200
  end
202
201
  end
@@ -242,9 +241,9 @@ describe "Indirect containers" do
242
241
  end
243
242
 
244
243
  describe "#first" do
245
- subject { reloaded.related_objects.first }
244
+ subject(:first) { reloaded.related_objects.first }
246
245
  it "has the content" do
247
- expect(subject.title).to eq 'HMMM'
246
+ expect(first.title).to eq 'HMMM'
248
247
  end
249
248
  end
250
249
  end
@@ -280,9 +279,9 @@ describe "Indirect containers" do
280
279
  end
281
280
 
282
281
  describe "#first" do
283
- subject { reloaded.related_objects.first }
282
+ subject(:first) { reloaded.related_objects.first }
284
283
  it "has the content" do
285
- expect(subject.title).to eq 'HMMM'
284
+ expect(first.title).to eq 'HMMM'
286
285
  end
287
286
  end
288
287
  end
@@ -21,12 +21,12 @@ describe "Objects should be serialized to JSON" do
21
21
 
22
22
  before { allow(obj).to receive(:id).and_return('test-123') }
23
23
 
24
- subject { JSON.parse(obj.to_json) }
24
+ let(:json) { JSON.parse(obj.to_json) }
25
25
 
26
26
  it "has to_json" do
27
- expect(subject['id']).to eq "test-123"
28
- expect(subject['title']).to eq ["My Title"]
29
- expect(subject['description']).to eq "Wonderful stuff"
27
+ expect(json['id']).to eq "test-123"
28
+ expect(json['title']).to eq ["My Title"]
29
+ expect(json['description']).to eq "Wonderful stuff"
30
30
  end
31
31
  end
32
32
  end
@@ -2,35 +2,23 @@ require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::QueryResultBuilder do
4
4
  describe "#reify_solr_results" do
5
- before(:each) do
5
+ before do
6
6
  class FooObject < ActiveFedora::Base
7
7
  def self.id_namespace
8
8
  "foo"
9
9
  end
10
-
11
- has_subresource :descMetadata, class_name: 'ActiveFedora::QualifiedDublinCoreDatastream'
12
10
  end
13
- @test_object = ActiveFedora::Base.new
14
- @foo_object = FooObject.new
15
- attributes = { "language" => { 0 => "Italian" },
16
- "creator" => { 0 => "Linguist, A." },
17
- "geography" => { 0 => "Italy" },
18
- "title" => { 0 => "Italian and Spanish: A Comparison of Common Phrases" } }
19
- @foo_object.descMetadata.update_indexed_attributes(attributes)
20
- @test_object.save
21
- @foo_object.save
22
- @profiles = {
23
- # 'test' => @test_object.profile,
24
- # 'foo' => @foo_object.profile,
25
- # 'foo_descMetadata' => @foo_object.datastreams['descMetadata'].profile
26
- }
27
- @foo_content = @foo_object.attached_files['descMetadata'].content
28
11
  end
29
- after(:each) do
12
+
13
+ let(:test_object) { ActiveFedora::Base.create }
14
+ let(:foo_object) { FooObject.create }
15
+
16
+ after do
30
17
  Object.send(:remove_const, :FooObject)
31
18
  end
19
+
32
20
  it "returns an array of objects that are of the class stored in active_fedora_model_s" do
33
- query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids([@test_object.id, @foo_object.id])
21
+ query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids([test_object.id, foo_object.id])
34
22
  solr_result = ActiveFedora::SolrService.query(query)
35
23
  result = described_class.reify_solr_results(solr_result)
36
24
  expect(result.length).to eq 2
@@ -40,7 +28,7 @@ describe ActiveFedora::QueryResultBuilder do
40
28
  end
41
29
 
42
30
  it '#reifies a lightweight object as a new instance' do
43
- query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids([@foo_object.id])
31
+ query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids([foo_object.id])
44
32
  solr_result = ActiveFedora::SolrService.query(query)
45
33
  result = described_class.reify_solr_results(solr_result, load_from_solr: true)
46
34
  expect(result.first).to be_instance_of FooObject
@@ -9,7 +9,7 @@ describe "Nesting attribute behavior of RDF resources" do
9
9
  end
10
10
 
11
11
  class CustomName < ActiveFedora::Base
12
- property :pref_label, predicate: ::RDF::SKOS.prefLabel, multiple: false
12
+ property :pref_label, predicate: ::RDF::Vocab::SKOS.prefLabel, multiple: false
13
13
  end
14
14
 
15
15
  class CustomSource < ActiveFedora::Base
@@ -38,25 +38,25 @@ describe "Nesting attribute behavior of RDF resources" do
38
38
  end
39
39
 
40
40
  context "with an AT resource as a property" do
41
- subject { ComplexResource.new }
41
+ subject(:complex_resource) { ComplexResource.new }
42
42
 
43
43
  let(:params) { [{ subject: 'Foo' }, { subject: 'Bar' }] }
44
44
 
45
45
  before do
46
46
  ComplexResource.accepts_nested_attributes_for(*args)
47
- subject.topic_attributes = params
47
+ complex_resource.topic_attributes = params
48
48
  end
49
49
 
50
50
  context "when no options are set" do
51
51
  let(:args) { [:topic] }
52
52
 
53
53
  it "sets the attributes" do
54
- expect(subject.topic.size).to eq 2
55
- expect(subject.topic.map(&:subject)).to eq [['Foo'], ['Bar']]
54
+ expect(complex_resource.topic.size).to eq 2
55
+ expect(complex_resource.topic.map(&:subject)).to contain_exactly ['Foo'], ['Bar']
56
56
  end
57
57
 
58
58
  it "marks the attributes as changed" do
59
- expect(subject.changed_attributes).to eq('topic' => [])
59
+ expect(complex_resource.changed_attributes.keys).to eq ["topic"]
60
60
  end
61
61
  end
62
62
 
@@ -66,7 +66,7 @@ describe "Nesting attribute behavior of RDF resources" do
66
66
  let(:params) { [{ subject: 'Foo' }, { subject: 'Bar' }] }
67
67
 
68
68
  it "does not add terms for which the proc is true" do
69
- expect(subject.topic.map(&:subject)).to eq [['Foo']]
69
+ expect(complex_resource.topic.map(&:subject)).to eq [['Foo']]
70
70
  end
71
71
  end
72
72
  end
@@ -25,30 +25,28 @@ describe ActiveFedora::Base do
25
25
  let!(:instance2) { TestClass.create!(foo: ['Alpha'], bar: ['Peanuts']) }
26
26
  let!(:instance3) { TestClass.create!(foo: ['Sigma'], bar: ['Peanuts']) }
27
27
 
28
- subject { TestClass.where(bar: 'Peanuts') }
28
+ subject(:peanuts) { TestClass.where(bar: 'Peanuts') }
29
29
 
30
30
  it "maps" do
31
- expect(subject.map(&:id)).to eq [instance2.id, instance3.id]
31
+ expect(peanuts.map(&:id)).to contain_exactly instance2.id, instance3.id
32
32
  end
33
33
 
34
34
  it "collects" do
35
- expect(subject.collect(&:id)).to eq [instance2.id, instance3.id]
35
+ expect(peanuts.collect(&:id)).to contain_exactly instance2.id, instance3.id
36
36
  end
37
37
 
38
38
  it "has each" do
39
- t = double
40
- expect(t).to receive(:foo).twice
41
- subject.each { t.foo }
39
+ expect(peanuts.each.to_a.length).to eq 2
42
40
  end
43
41
 
44
42
  it "has all?" do
45
- expect(subject.all? { |t| t.foo == ['Alpha'] }).to be false
46
- expect(subject.all? { |t| t.bar == ['Peanuts'] }).to be true
43
+ expect(peanuts.all? { |t| t.foo == ['Alpha'] }).to be false
44
+ expect(peanuts.all? { |t| t.bar == ['Peanuts'] }).to be true
47
45
  end
48
46
 
49
47
  it "has include?" do
50
- expect(subject.include?(instance1)).to be false
51
- expect(subject.include?(instance2)).to be true
48
+ expect(peanuts.include?(instance1)).to be false
49
+ expect(peanuts.include?(instance2)).to be true
52
50
  end
53
51
  end
54
52
  end
@@ -15,15 +15,13 @@ describe ActiveFedora::Base do
15
15
  Object.send(:remove_const, :Book)
16
16
  end
17
17
 
18
- subject { Library.all }
18
+ subject(:libraries) { Library.all }
19
19
 
20
20
  it "is a relation" do
21
- expect(subject.class).to be ActiveFedora::Relation
21
+ expect(libraries.class).to be ActiveFedora::Relation
22
22
  end
23
23
 
24
- it "is enumerable" do
25
- expect(subject).to respond_to(:each_with_index)
26
- end
24
+ it { is_expected.to respond_to(:each_with_index) }
27
25
 
28
26
  context "when some records exist" do
29
27
  before do
@@ -34,43 +32,42 @@ describe ActiveFedora::Base do
34
32
 
35
33
  describe "is cached" do
36
34
  before do
37
- subject.to_a # trigger initial load
35
+ libraries.to_a # trigger initial load
38
36
  end
39
37
 
40
- it "is loaded" do
41
- expect(subject).to be_loaded
42
- end
38
+ it { is_expected.to be_loaded }
39
+
43
40
  it "does not reload" do
44
41
  expect_any_instance_of(ActiveFedora::Relation).to_not receive :find_each
45
- subject[0]
42
+ libraries[0]
46
43
  end
47
44
  end
48
45
 
49
46
  describe "#find" do
50
47
  it "finds one of them" do
51
- expect(subject.find(library1.id)).to eq library1
48
+ expect(libraries.find(library1.id)).to eq library1
52
49
  end
53
50
  it "finds with a block" do
54
- expect(subject.find { |l| l.id == library1.id }).to eq library1
51
+ expect(libraries.find { |l| l.id == library1.id }).to eq library1
55
52
  end
56
53
  end
57
54
 
58
55
  describe "#select" do
59
56
  it "finds with a block" do
60
- expect(subject.select { |l| l.id == library1.id }).to eq [library1]
57
+ expect(libraries.select { |l| l.id == library1.id }).to eq [library1]
61
58
  end
62
59
  end
63
60
 
64
61
  context "unpermitted methods" do
65
62
  it "excludes them" do
66
- expect { subject.sort! }.to raise_error NoMethodError
63
+ expect { libraries.sort! }.to raise_error NoMethodError
67
64
  end
68
65
  end
69
66
 
70
67
  context "when limit is applied" do
71
- subject { Library.create books: [Book.create, Book.create] }
68
+ subject(:libraries) { Library.create books: [Book.create, Book.create] }
72
69
  it "limits the number of books" do
73
- expect(subject.books.limit(1).size).to eq 1
70
+ expect(libraries.books.limit(1).size).to eq 1
74
71
  end
75
72
  end
76
73
  end
@@ -65,15 +65,16 @@ describe ActiveFedora::Querying do
65
65
  field = ActiveFedora.index_field_mapper.solr_name('foo', type: :string)
66
66
  expect(ModelIntegrationSpec::Basic.where(field => 'Beta')).to eq [test_instance1]
67
67
  expect(ModelIntegrationSpec::Basic.where('foo' => 'Beta')).to eq [test_instance1]
68
+ expect(ModelIntegrationSpec::Basic.where('foo' => ['Beta', 'Alpha'])).to eq [test_instance1, test_instance2]
68
69
  end
69
70
  it "orders" do
70
- expect(ModelIntegrationSpec::Basic.order(ActiveFedora.index_field_mapper.solr_name('foo', :sortable) + ' asc')).to eq [test_instance2, test_instance1, test_instance3]
71
+ expect(ModelIntegrationSpec::Basic.order(ActiveFedora.index_field_mapper.solr_name('foo', :sortable) + ' asc')).to contain_exactly test_instance2, test_instance1, test_instance3
71
72
  end
72
73
  it "limits" do
73
74
  expect(ModelIntegrationSpec::Basic.limit(1)).to eq [test_instance1]
74
75
  end
75
76
  it "offsets" do
76
- expect(ModelIntegrationSpec::Basic.offset(1)).to eq [test_instance2, test_instance3]
77
+ expect(ModelIntegrationSpec::Basic.offset(1)).to contain_exactly test_instance2, test_instance3
77
78
  end
78
79
 
79
80
  it "chains queries" do
@@ -126,7 +127,7 @@ describe ActiveFedora::Querying do
126
127
  end
127
128
  it "logs an error" do
128
129
  expect(ActiveFedora::Base.logger).to receive(:error).with("Although #{id} was found in Solr, it doesn't seem to exist in Fedora. The index is out of synch.")
129
- expect(ModelIntegrationSpec::Basic.all).to eq [test_instance1, test_instance3]
130
+ expect(ModelIntegrationSpec::Basic.all).to contain_exactly test_instance1, test_instance3
130
131
  end
131
132
  end
132
133
  end
@@ -19,25 +19,14 @@ describe ActiveFedora::SolrHit do
19
19
  ) }
20
20
 
21
21
  let(:doc) { obj.to_solr }
22
- let(:solr_hit) { described_class.new(doc) }
22
+ subject(:solr_hit) { described_class.new(doc) }
23
23
 
24
24
  describe "#reify" do
25
- subject { solr_hit.reify }
25
+ let(:solr_reified) { solr_hit.reify }
26
26
 
27
27
  it "finds the document in solr" do
28
- expect(subject).to be_instance_of Foo
29
- expect(subject.title).to eq 'My Title'
30
- end
31
- end
32
-
33
- describe "#instantiate_with_json" do
34
- subject { solr_hit.instantiate_with_json }
35
-
36
- it { is_expected.to be_persisted }
37
-
38
- it "finds the document in solr" do
39
- expect(subject).to be_instance_of Foo
40
- expect(subject.title).to eq 'My Title'
28
+ expect(solr_reified).to be_instance_of Foo
29
+ expect(solr_reified.title).to eq 'My Title'
41
30
  end
42
31
  end
43
32
  end