active-fedora 11.0.0.rc7 → 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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +2 -7
  4. data/.rubocop_todo.yml +40 -9
  5. data/active-fedora.gemspec +2 -2
  6. data/lib/active_fedora/associations/collection_association.rb +1 -1
  7. data/lib/active_fedora/associations/contained_finder.rb +2 -2
  8. data/lib/active_fedora/change_set.rb +6 -2
  9. data/lib/active_fedora/core.rb +18 -7
  10. data/lib/active_fedora/fedora_attributes.rb +1 -1
  11. data/lib/active_fedora/indexing_service.rb +0 -4
  12. data/lib/active_fedora/orders/ordered_list.rb +2 -2
  13. data/lib/active_fedora/relation/delegation.rb +4 -0
  14. data/lib/active_fedora/solr_hit.rb +0 -4
  15. data/lib/active_fedora/solr_query_builder.rb +16 -12
  16. data/lib/active_fedora/version.rb +1 -1
  17. data/spec/config_helper.rb +1 -1
  18. data/spec/integration/autosave_association_spec.rb +1 -1
  19. data/spec/integration/base_spec.rb +1 -1
  20. data/spec/integration/file_spec.rb +1 -1
  21. data/spec/integration/indexing_spec.rb +1 -1
  22. data/spec/integration/query_result_builder_spec.rb +1 -1
  23. data/spec/integration/relation_delegation_spec.rb +1 -3
  24. data/spec/integration/versionable_spec.rb +4 -4
  25. data/spec/spec_helper.rb +52 -3
  26. data/spec/unit/active_fedora_spec.rb +1 -1
  27. data/spec/unit/association_hash_spec.rb +8 -22
  28. data/spec/unit/attached_files_spec.rb +6 -6
  29. data/spec/unit/base_cma_spec.rb +1 -1
  30. data/spec/unit/base_extra_spec.rb +2 -18
  31. data/spec/unit/base_spec.rb +1 -1
  32. data/spec/unit/callback_spec.rb +2 -2
  33. data/spec/unit/checksum_spec.rb +2 -2
  34. data/spec/unit/code_configurator_spec.rb +1 -1
  35. data/spec/unit/core_spec.rb +36 -0
  36. data/spec/unit/default_model_mapper_spec.rb +3 -3
  37. data/spec/unit/file_configurator_spec.rb +4 -4
  38. data/spec/unit/file_path_builder_spec.rb +1 -1
  39. data/spec/unit/file_spec.rb +1 -1
  40. data/spec/unit/files_hash_spec.rb +2 -2
  41. data/spec/unit/finder_methods_spec.rb +3 -3
  42. data/spec/unit/has_and_belongs_to_many_association_spec.rb +0 -2
  43. data/spec/unit/has_many_association_spec.rb +2 -2
  44. data/spec/unit/indexing_spec.rb +2 -2
  45. data/spec/unit/logger_spec.rb +1 -1
  46. data/spec/unit/orders/reflection_spec.rb +1 -1
  47. data/spec/unit/property_spec.rb +2 -2
  48. data/spec/unit/query_spec.rb +1 -1
  49. data/spec/unit/reflection_spec.rb +3 -3
  50. data/spec/unit/solr_config_options_spec.rb +1 -1
  51. data/spec/unit/solr_service_spec.rb +4 -10
  52. data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +1 -1
  53. data/spec/unit/with_metadata/metadata_node_spec.rb +1 -1
  54. metadata +10 -17
  55. data/spec/fixtures/damsObjectModel.xml +0 -38
  56. data/spec/fixtures/dublin_core_rdf_descMetadata.nt +0 -13
  57. data/spec/fixtures/mixed_rdf_descMetadata.nt +0 -7
  58. data/spec/fixtures/mods_articles/mods_article1.xml +0 -98
  59. data/spec/fixtures/solr_rdf_descMetadata.nt +0 -7
  60. data/spec/samples/oral_history_sample.xml +0 -38
  61. data/spec/samples/oral_history_xml.xml +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc7a3946a47ca155b5b2e9fa9f62514e4be440c8
4
- data.tar.gz: c64e65c2107219cc400cbd66f586388fd0a3e6cc
3
+ metadata.gz: 1a3e4470dd33d72dc20a0794fd42e8a08d96363f
4
+ data.tar.gz: 9e7b438a6b8a23515de79c50b3f44dc2df2a6d3f
5
5
  SHA512:
6
- metadata.gz: cd127fc65d51bcc2421d4be1693a5332ff4d14cdbea316fab935fb425b5527371fade8a5ee9c7d079119e613040dec9e35a71bfc29fdf7fac4a09287c1f49df3
7
- data.tar.gz: 7781a22aa37f934c60bef92898d8c02cbd7cff702272e8f855b9f03b65179a602d2186ee43b4f58bc63fa3b750df40b5b6e6fb1bc781a941bc5b4029624e7330
6
+ metadata.gz: f86db04efd279c3412c1e57fa8449f7fbef3ac6cb83143314b573edaf559dfca3bc0bab762ada09c87c0f86759aea537f812bd194c3361f8adbea78385abbfe3
7
+ data.tar.gz: fd864a26944cc8e5ca33b313a1a2544dcfa965e46005a16c6a4833755f85e82ab349e36470347c02eef601b979213c3877c2691153a41c81429595337dc68ead
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ bin
15
15
  gemfiles/*.gemfile.lock
16
16
  /fcrepo4-data
17
17
  /fcrepo4-test-data
18
+ /spec/examples.txt
data/.rubocop.yml CHANGED
@@ -1,3 +1,5 @@
1
+ require: rubocop-rspec
2
+
1
3
  inherit_from:
2
4
  - .rubocop_todo.yml
3
5
 
@@ -45,7 +47,6 @@ Metrics/CyclomaticComplexity:
45
47
  - 'lib/active_fedora/associations/builder/directly_contains_one.rb'
46
48
  - 'lib/active_fedora/file_configurator.rb'
47
49
  - 'lib/active_fedora/file.rb'
48
- - 'lib/active_fedora/datastreams/nokogiri_datastreams.rb'
49
50
  - 'lib/active_fedora/attribute_methods.rb'
50
51
  - 'lib/active_fedora/scoping/named.rb'
51
52
  - 'lib/active_fedora/inheritance.rb'
@@ -56,7 +57,6 @@ Metrics/PerceivedComplexity:
56
57
  - 'lib/active_fedora/relation/finder_methods.rb'
57
58
  - 'lib/active_fedora/nested_attributes.rb'
58
59
  - 'lib/active_fedora/file_configurator.rb'
59
- - 'lib/active_fedora/datastreams/nokogiri_datastreams.rb'
60
60
  - 'lib/active_fedora/autosave_association.rb'
61
61
  - 'lib/active_fedora/associations/has_many_association.rb'
62
62
  - 'lib/active_fedora/associations/has_and_belongs_to_many_association.rb'
@@ -79,10 +79,7 @@ Metrics/ModuleLength:
79
79
 
80
80
  Metrics/ClassLength:
81
81
  Exclude:
82
- - 'spec/samples/hydra-mods_article_datastream.rb'
83
- - 'lib/active_fedora/rdf/rdf_datastream.rb'
84
82
  - 'lib/active_fedora/rdf/fcrepo.rb'
85
- - 'lib/active_fedora/qualified_dublin_core_datastream.rb'
86
83
  - 'lib/active_fedora/file_configurator.rb'
87
84
  - 'lib/active_fedora/file.rb'
88
85
  - 'lib/active_fedora/associations/association.rb'
@@ -121,7 +118,6 @@ Style/PredicateName:
121
118
  - 'lib/active_fedora/versionable.rb'
122
119
  - 'lib/active_fedora/reflection.rb'
123
120
  - 'lib/active_fedora/pathing.rb'
124
- - 'lib/active_fedora/om_datastream.rb'
125
121
  - 'lib/active_fedora/nested_attributes.rb'
126
122
  - 'lib/active_fedora/clean_connection.rb'
127
123
  - 'lib/active_fedora/attributes.rb'
@@ -219,7 +215,6 @@ Style/SignalException:
219
215
  Style/FileName:
220
216
  Exclude:
221
217
  - 'lib/active-fedora.rb'
222
- - 'spec/samples/hydra-mods_article_datastream.rb'
223
218
 
224
219
  Style/ZeroLengthPredicate:
225
220
  Exclude:
data/.rubocop_todo.yml CHANGED
@@ -1,24 +1,55 @@
1
1
  require: rubocop-rspec
2
+
2
3
  # This configuration was generated by
3
4
  # `rubocop --auto-gen-config`
4
- # on 2016-07-29 08:55:51 -0500 using RuboCop version 0.42.0.
5
+ # on 2016-08-25 16:34:38 -0700 using RuboCop version 0.42.0.
5
6
  # The point is for the user to remove these configuration records
6
7
  # one by one as the offenses are removed from the code base.
7
8
  # Note that changes in the inspected code, or installation of new
8
9
  # versions of RuboCop, may require this file to be generated again.
9
10
 
10
- # Offense count: 133
11
+ # Offense count: 116
11
12
  # Configuration parameters: Max.
12
13
  RSpec/ExampleLength:
13
14
  Enabled: false
14
15
 
15
- # Offense count: 58
16
- # Configuration parameters: IgnoreSymbolicNames.
17
- RSpec/VerifiedDoubles:
16
+ # Offense count: 40
17
+ RSpec/LeadingSubject:
18
18
  Enabled: false
19
19
 
20
- # Offense count: 2
21
- Style/MethodMissing:
20
+ # Offense count: 15
21
+ RSpec/LetSetup:
22
+ Exclude:
23
+ - 'spec/integration/collection_association_spec.rb'
24
+ - 'spec/integration/delete_all_spec.rb'
25
+ - 'spec/integration/has_many_associations_spec.rb'
26
+ - 'spec/integration/nested_attribute_spec.rb'
27
+ - 'spec/integration/persistence_spec.rb'
28
+ - 'spec/unit/has_and_belongs_to_many_association_spec.rb'
29
+
30
+ # Offense count: 1
31
+ RSpec/MessageChain:
22
32
  Exclude:
23
- - 'lib/active_fedora/nom_datastream.rb'
24
- - 'lib/active_fedora/relation/delegation.rb'
33
+ - 'spec/unit/file_spec.rb'
34
+
35
+ # Offense count: 218
36
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
37
+ # SupportedStyles: allow, expect
38
+ RSpec/MessageExpectation:
39
+ Enabled: false
40
+
41
+ # Offense count: 238
42
+ RSpec/MultipleExpectations:
43
+ Max: 8
44
+
45
+ # Offense count: 394
46
+ # Configuration parameters: MaxNesting.
47
+ RSpec/NestedGroups:
48
+ Enabled: false
49
+
50
+ # Offense count: 94
51
+ RSpec/SubjectStub:
52
+ Enabled: false
53
+
54
+ RSpec/VerifiedDoubles:
55
+ Enabled: false
@@ -14,11 +14,11 @@ Gem::Specification.new do |s|
14
14
  s.license = "APACHE2"
15
15
  s.required_ruby_version = '~> 2.0'
16
16
 
17
- s.add_dependency 'rsolr', '~> 1.0', '>= 1.0.10'
17
+ s.add_dependency 'rsolr', '~> 1.1', '>= 1.1.2'
18
18
  s.add_dependency 'solrizer', '~> 3.4'
19
19
  s.add_dependency "activesupport", '>= 4.2.4', '< 6'
20
20
  s.add_dependency "activemodel", '>= 4.2', '< 6'
21
- s.add_dependency "active-triples", '~> 0.10.0'
21
+ s.add_dependency "active-triples", '~> 0.11.0'
22
22
  s.add_dependency "deprecation"
23
23
  s.add_dependency "ldp", '~> 0.6.0'
24
24
 
@@ -291,7 +291,7 @@ module ActiveFedora
291
291
  def construct_query
292
292
  @solr_query ||= begin
293
293
  clauses = { find_reflection => @owner.id }
294
- clauses[:has_model] = @reflection.class_name.constantize.to_class_uri if @reflection.class_name && @reflection.class_name != 'ActiveFedora::Base'
294
+ clauses[:has_model] = @reflection.klass.to_rdf_representation if @reflection.klass != ActiveFedora::Base
295
295
  ActiveFedora::SolrQueryBuilder.construct_query_for_rel(clauses)
296
296
  end
297
297
  end
@@ -29,7 +29,7 @@ module ActiveFedora::Associations
29
29
  private
30
30
 
31
31
  def matching_ids(record)
32
- IDComposite.new(proxy_ids(record) & contained_ids, repository.translate_uri_to_id)
32
+ IDComposite.new(proxy_ids(record) & contained_ids.to_a, repository.translate_uri_to_id)
33
33
  end
34
34
 
35
35
  def proxy_ids(record)
@@ -40,7 +40,7 @@ module ActiveFedora::Associations
40
40
  # a slow fedora call
41
41
  def relation_subjects(record)
42
42
  query = ActiveFedora::SolrQueryBuilder.construct_query_for_rel(
43
- [[:has_model, proxy_class.to_class_uri], [:proxyFor, record.id]]
43
+ [[:has_model, proxy_class.to_rdf_representation], [:proxyFor, record.id]]
44
44
  )
45
45
  ActiveFedora::SolrService.query(query, fl: 'id').map(&:rdf_uri)
46
46
  end
@@ -23,8 +23,12 @@ module ActiveFedora
23
23
  result[predicate] = graph.query(subject: object.rdf_subject, predicate: predicate)
24
24
  elsif object.class.properties.keys.include?(key)
25
25
  predicate = graph.reflections.reflect_on_property(key).predicate
26
- result[predicate] = graph.query(subject: object.rdf_subject, predicate: predicate)
27
- result[predicate] = child_graphs(result[predicate].objects) << result[predicate]
26
+ results = graph.query(subject: object.rdf_subject, predicate: predicate)
27
+ new_graph = child_graphs(results.map(&:object))
28
+ results.each do |res|
29
+ new_graph << res
30
+ end
31
+ result[predicate] = new_graph
28
32
  elsif key == 'type'.freeze
29
33
  # working around https://github.com/ActiveTriples/ActiveTriples/issues/122
30
34
  predicate = ::RDF.type
@@ -96,13 +96,14 @@ module ActiveFedora
96
96
 
97
97
  protected
98
98
 
99
- # This can be overriden to assert a different model
100
- # It's normally called once in the lifecycle, by #create#
99
+ # This method is normally called once in the lifecycle, by #create#
101
100
  def assert_content_model
102
- self.has_model = self.class.to_s
101
+ self.has_model = self.class.to_rdf_representation
103
102
  end
104
103
 
105
104
  module ClassMethods
105
+ extend Deprecation
106
+
106
107
  def generated_association_methods
107
108
  @generated_association_methods ||= begin
108
109
  mod = const_set(:GeneratedAssociationMethods, Module.new)
@@ -111,13 +112,23 @@ module ActiveFedora
111
112
  end
112
113
  end
113
114
 
114
- # Returns a suitable uri object for :has_model
115
- # Should reverse Model#from_class_uri
116
- # TODO this is a poorly named method
117
- def to_class_uri(_attrs = {})
115
+ # Returns a suitable string representation for :has_model
116
+ # Override this method if you want to change how this class
117
+ # is represented in RDF.
118
+ def to_rdf_representation
118
119
  name
119
120
  end
120
121
 
122
+ # Returns a suitable string representation for :has_model
123
+ # @deprecated use to_rdf_representation instead
124
+ def to_class_uri(attrs = nil)
125
+ if attrs
126
+ Deprecation.warn ActiveFedora::Core, "to_class_uri no longer acceps an argument"
127
+ end
128
+ to_rdf_representation
129
+ end
130
+ deprecation_deprecate to_class_uri: "use 'to_rdf_representation()' instead"
131
+
121
132
  private
122
133
 
123
134
  def relation
@@ -43,7 +43,7 @@ module ActiveFedora
43
43
  # Appending the graph at the end is necessary because adding it as the
44
44
  # parent leaves behind triples not related to the ldp_source's rdf
45
45
  # subject.
46
- @resource ||= self.class.resource_class.new(@ldp_source.graph.rdf_subject, data: @ldp_source.graph.send(:graph).data)
46
+ @resource ||= self.class.resource_class.new(@ldp_source.graph.rdf_subject, data: @ldp_source.graph.graph.data)
47
47
  end
48
48
 
49
49
  # You can set the URI to use for the rdf_label on ClassMethods.rdf_label, then on
@@ -15,10 +15,6 @@ module ActiveFedora
15
15
  @object = obj
16
16
  end
17
17
 
18
- def self.profile_solr_name
19
- @profile_solr_name ||= ActiveFedora.index_field_mapper.solr_name("object_profile", :displayable)
20
- end
21
-
22
18
  def self.create_time_solr_name
23
19
  @create_time_solr_name ||= ActiveFedora.index_field_mapper.solr_name('system_create', :stored_sortable, type: :date)
24
20
  end
@@ -13,8 +13,8 @@ module ActiveFedora
13
13
  # @param [::RDF::URI] head_subject URI of head node in list.
14
14
  # @param [::RDF::URI] tail_subject URI of tail node in list.
15
15
  def initialize(graph, head_subject, tail_subject)
16
- @graph = if graph.respond_to?(:graph, true)
17
- graph.send(:graph).data
16
+ @graph = if graph.respond_to?(:graph)
17
+ graph.graph.data
18
18
  else
19
19
  graph
20
20
  end
@@ -29,5 +29,9 @@ module ActiveFedora
29
29
  super
30
30
  end
31
31
  end
32
+
33
+ def respond_to_missing?(method, *args)
34
+ array_delegable?(method) || super
35
+ end
32
36
  end
33
37
  end
@@ -55,9 +55,5 @@ module ActiveFedora
55
55
  def classifier
56
56
  ActiveFedora.model_mapper.classifier(document)
57
57
  end
58
-
59
- def profile_json
60
- Array(document[ActiveFedora::IndexingService.profile_solr_name]).first
61
- end
62
58
  end
63
59
  end
@@ -11,28 +11,29 @@ module ActiveFedora
11
11
  "{!terms f=#{ActiveFedora.id_field}}#{ids.join(',')}"
12
12
  end
13
13
 
14
- # Create a query with a clause for each key, value
14
+ # Create a raw query with a clause for each key, value
15
15
  # @param [Hash, Array<Array<String>>] field_pairs key is the predicate, value is the target_uri
16
16
  # @param [String] join_with ('AND') the value we're joining the clauses with
17
17
  # @example
18
- # construct_query_for_rel [[:has_model, "info:fedora/afmodel:ComplexCollection"], [:has_model, "info:fedora/afmodel:ActiveFedora_Base"]], 'OR'
19
- # # => _query_:"{!field f=has_model_ssim}info:fedora/afmodel:ComplexCollection" OR _query_:"{!field f=has_model_ssim}info:fedora/afmodel:ActiveFedora_Base"
18
+ # construct_query_for_rel [[:has_model, "ComplexCollection"], [:has_model, "ActiveFedora_Base"]], 'OR'
19
+ # # => _query_:"{!raw f=has_model_ssim}ComplexCollection" OR _query_:"{!raw f=has_model_ssim}ActiveFedora_Base"
20
20
  #
21
21
  # construct_query_for_rel [[Book._reflect_on_association(:library), "foo/bar/baz"]]
22
22
  def construct_query_for_rel(field_pairs, join_with = default_join_with)
23
23
  field_pairs = field_pairs.to_a if field_pairs.is_a? Hash
24
- construct_query(property_values_to_solr(field_pairs), join_with)
24
+ construct_query(property_values_to_solr(field_pairs), join_with, 'raw'.freeze)
25
25
  end
26
26
 
27
27
  # Construct a solr query from a list of pairs (e.g. [field name, values])
28
28
  # @param [Array<Array>] field_pairs a list of pairs of property name and values
29
29
  # @param [String] join_with ('AND') the value we're joining the clauses with
30
+ # @param [String] type ('field') The type of query to run. Either 'raw' or 'field'
30
31
  # @return [String] a solr query
31
32
  # @example
32
33
  # construct_query([['library_id_ssim', '123'], ['owner_ssim', 'Fred']])
33
34
  # # => "_query_:\"{!field f=library_id_ssim}123\" AND _query_:\"{!field f=owner_ssim}Fred\""
34
- def construct_query(field_pairs, join_with = default_join_with)
35
- clauses = pairs_to_clauses(field_pairs)
35
+ def construct_query(field_pairs, join_with = default_join_with, type = 'field'.freeze)
36
+ clauses = pairs_to_clauses(field_pairs, type)
36
37
  return "" if clauses.count.zero?
37
38
  return clauses.first if clauses.count == 1
38
39
  "(#{clauses.join(join_with)})"
@@ -45,22 +46,24 @@ module ActiveFedora
45
46
  private
46
47
 
47
48
  # @param [Array<Array>] pairs a list of (key, value) pairs. The value itself may
49
+ # @param [String] type The type of query to run. Either 'raw' or 'field'
48
50
  # @return [Array] a list of solr clauses
49
- def pairs_to_clauses(pairs)
51
+ def pairs_to_clauses(pairs, type)
50
52
  pairs.flat_map do |field, value|
51
- condition_to_clauses(field, value)
53
+ condition_to_clauses(field, value, type)
52
54
  end
53
55
  end
54
56
 
55
57
  # @param [String] field
56
58
  # @param [String, Array<String>] values
59
+ # @param [String] type The type of query to run. Either 'raw' or 'field'
57
60
  # @return [Array<String>]
58
- def condition_to_clauses(field, values)
61
+ def condition_to_clauses(field, values, type)
59
62
  values = Array(values)
60
63
  values << nil if values.empty?
61
64
  values.map do |value|
62
65
  if value.present?
63
- field_query(field, value)
66
+ query_clause(type, field, value)
64
67
  else
65
68
  # Check that the field is not present. In SQL: "WHERE field IS NULL"
66
69
  "-#{field}:[* TO *]"
@@ -93,10 +96,11 @@ module ActiveFedora
93
96
  end
94
97
 
95
98
  # Create a raw query clause suitable for sending to solr as an fq element
99
+ # @param [String] type The type of query to run. Either 'raw' or 'field'
96
100
  # @param [String] key
97
101
  # @param [String] value
98
- def field_query(key, value)
99
- "_query_:\"{!field f=#{key}}#{value.gsub('"', '\"')}\""
102
+ def query_clause(type, key, value)
103
+ "_query_:\"{!#{type} f=#{key}}#{value.gsub('"', '\"')}\""
100
104
  end
101
105
  end
102
106
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "11.0.0.rc7".freeze
2
+ VERSION = "11.0.0".freeze
3
3
  end
@@ -1,5 +1,5 @@
1
1
  def mock_yaml(hash, path)
2
- mock_file = double(path.split("/")[-1])
2
+ mock_file = instance_double(File, path.split("/")[-1])
3
3
  allow(File).to receive(:exist?).with(path).and_return(true)
4
4
  allow(File).to receive(:open).with(path).and_return(mock_file)
5
5
  allow(Psych).to receive(:load).and_return(hash)
@@ -12,7 +12,7 @@ describe ActiveFedora::Base do
12
12
  subject(:relationship) { MockAFBaseRelationship.new }
13
13
 
14
14
  context '#changed_for_autosave?' do
15
- before(:each) do
15
+ before do
16
16
  expect(relationship).to receive(:new_record?).and_return(false)
17
17
  expect(relationship).to receive(:changed?).and_return(false)
18
18
  expect(relationship).to receive(:marked_for_destruction?).and_return(false)
@@ -145,7 +145,7 @@ describe ActiveFedora::Base do
145
145
  let(:conditions) { { foo: "bar" } }
146
146
  context "and at least one object matches the conditions" do
147
147
  it "returns true" do
148
- allow(ActiveFedora::SolrService).to receive(:query) { [double("solr document")] }
148
+ allow(ActiveFedora::SolrService).to receive(:query) { [instance_double(RSolr::HashWithResponse)] }
149
149
  expect(described_class.exists?(conditions)).to be true
150
150
  end
151
151
  end
@@ -131,7 +131,7 @@ describe ActiveFedora::File do
131
131
  end
132
132
 
133
133
  describe "streaming the response" do
134
- let(:stream_reader) { double }
134
+ let(:stream_reader) { instance_double(IO) }
135
135
  it "streams the response" do
136
136
  expect(stream_reader).to receive(:read).at_least(:once)
137
137
  test_object.attached_files[path].stream.each { |buff| stream_reader.read(buff) }
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  describe ActiveFedora::Base do
5
5
  describe "descendant_uris" do
6
- before :each do
6
+ before do
7
7
  ids.each do |id|
8
8
  described_class.create id: id
9
9
  end
@@ -13,7 +13,7 @@ describe ActiveFedora::QueryResultBuilder do
13
13
  let(:test_object) { ActiveFedora::Base.create }
14
14
  let(:foo_object) { FooObject.create }
15
15
 
16
- after(:each) do
16
+ after do
17
17
  Object.send(:remove_const, :FooObject)
18
18
  end
19
19
 
@@ -36,9 +36,7 @@ describe ActiveFedora::Base do
36
36
  end
37
37
 
38
38
  it "has each" do
39
- t = double
40
- expect(t).to receive(:foo).twice
41
- peanuts.each { t.foo }
39
+ expect(peanuts.each.to_a.length).to eq 2
42
40
  end
43
41
 
44
42
  it "has all?" do