Class: ObjectComparator

Inherits:
Object
  • Object
show all
Defined in:
lib/object_comparator.rb,
lib/object_comparator/version.rb,
lib/object_comparator/minitest.rb

Defined Under Namespace

Modules: Minitest Classes: InspectionString

Constant Summary collapse

VERSION =
"0.1.4"

Instance Method Summary collapse

Instance Method Details

#equal?(one, other) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
# File 'lib/object_comparator.rb', line 4

def equal?(one, other)
  one = InspectionString.new(one.inspect)
  other = InspectionString.new(other.inspect)
  one == other
end

#failing_message_for_should(one, other) ⇒ Object



10
11
12
13
14
15
# File 'lib/object_comparator.rb', line 10

def failing_message_for_should(one, other)
  one = InspectionString.new(one.inspect)
  other = InspectionString.new(other.inspect)

  "expected #{other} to be equal to #{one}"
end

#failing_message_for_should_not(one, other) ⇒ Object



17
18
19
20
21
22
# File 'lib/object_comparator.rb', line 17

def failing_message_for_should_not(one, other)
  one = InspectionString.new(one.inspect)
  other = InspectionString.new(other.inspect)

  "expected #{other} not to be equal to #{one}"
end