Module: SuperDiff::RSpec::ObjectInspection::Inspectors

Defined in:
lib/super_diff/rspec/object_inspection/inspectors.rb,
lib/super_diff/rspec/object_inspection/inspectors/hash_including.rb,
lib/super_diff/rspec/object_inspection/inspectors/collection_including.rb,
lib/super_diff/rspec/object_inspection/inspectors/object_having_attributes.rb,
lib/super_diff/rspec/object_inspection/inspectors/collection_containing_exactly.rb

Constant Summary collapse

HashIncluding =
SuperDiff::ObjectInspection::InspectionTree.new do
  add_text "#<a hash including ("

  nested do |aliased_matcher|
    insert_hash_inspection_of(
      aliased_matcher.expecteds.first,
      initial_break: nil,
    )
  end

  add_break
  add_text ")>"
end
CollectionIncluding =
SuperDiff::ObjectInspection::InspectionTree.new do
  def self.applies_to?(object)
    SuperDiff::RSpec.a_collection_including?(object)
  end

  add_text "#<a collection including ("

  nested do |aliased_matcher|
    insert_array_inspection_of(aliased_matcher.expecteds)
  end

  add_break
  add_text ")>"
end
ObjectHavingAttributes =
SuperDiff::ObjectInspection::InspectionTree.new do
  add_text "#<an object having attributes ("

  nested do |aliased_matcher|
    insert_hash_inspection_of(
      aliased_matcher.expected,
      initial_break: nil,
    )
  end

  add_break
  add_text ")>"
end
CollectionContainingExactly =
SuperDiff::ObjectInspection::InspectionTree.new do
  add_text "#<a collection containing exactly ("

  nested do |aliased_matcher|
    insert_array_inspection_of(aliased_matcher.expected)
  end

  add_break
  add_text ")>"
end