Module: SuperDiff::RSpec::ObjectInspection::MapExtension

Defined in:
lib/super_diff/rspec/object_inspection/map_extension.rb

Instance Method Summary collapse

Instance Method Details

#call(object) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/super_diff/rspec/object_inspection/map_extension.rb', line 5

def call(object)
  if SuperDiff::RSpec.a_hash_including_something?(object)
    Inspectors::HashIncluding
  elsif SuperDiff::RSpec.a_collection_including_something?(object)
    Inspectors::CollectionIncluding
  elsif SuperDiff::RSpec.an_object_having_some_attributes?(object)
    Inspectors::ObjectHavingAttributes
  elsif SuperDiff::RSpec.a_collection_containing_exactly_something?(object)
    Inspectors::CollectionContainingExactly
  elsif object.is_a?(::RSpec::Mocks::Double)
    SuperDiff::ObjectInspection::Inspectors::Primitive
  else
    super
  end
end