Class: RTest::Equal

Inherits:
Object
  • Object
show all
Defined in:
lib/rtest/equal.rb

Constant Summary collapse

FAILURE_MESSAGE_FOR_TO =
"does not match, expecting {match}, got {compare}"
FAILURE_MESSAGE_FOR_NOT_TO =
"match, expecting somthing different to {match}, got {compare}"
SUCCESS_MESSAGE_FOR_TO =
"objects match"
SUCCESS_MESSAGE_FOR_NOT_TO =
"objects does not match"

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Equal

Returns a new instance of Equal.



9
10
11
# File 'lib/rtest/equal.rb', line 9

def initialize(object)
  @match_object = object
end

Instance Method Details

#failure_message_for_not_toObject



22
23
24
# File 'lib/rtest/equal.rb', line 22

def failure_message_for_not_to
  substitute_comparisons(FAILURE_MESSAGE_FOR_NOT_TO)
end

#failure_message_for_toObject



18
19
20
# File 'lib/rtest/equal.rb', line 18

def failure_message_for_to
  substitute_comparisons(FAILURE_MESSAGE_FOR_TO)
end

#match?(compare_object) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/rtest/equal.rb', line 13

def match?(compare_object)
  @compare_object = compare_object
  @match_object == @compare_object
end

#success_message_for_not_toObject



30
31
32
# File 'lib/rtest/equal.rb', line 30

def success_message_for_not_to
  SUCCESS_MESSAGE_FOR_NOT_TO
end

#success_message_for_toObject



26
27
28
# File 'lib/rtest/equal.rb', line 26

def success_message_for_to
  SUCCESS_MESSAGE_FOR_TO
end