class RTest::Equal

Constants

FAILURE_MESSAGE_FOR_NOT_TO
FAILURE_MESSAGE_FOR_TO
SUCCESS_MESSAGE_FOR_NOT_TO
SUCCESS_MESSAGE_FOR_TO

Public Class Methods

new(object) click to toggle source
# File lib/rtest/equal.rb, line 9
def initialize(object)
  @match_object = object
end

Public Instance Methods

failure_message_for_not_to() click to toggle source
# File lib/rtest/equal.rb, line 22
def failure_message_for_not_to
  substitute_comparisons(FAILURE_MESSAGE_FOR_NOT_TO)
end
failure_message_for_to() click to toggle source
# File lib/rtest/equal.rb, line 18
def failure_message_for_to
  substitute_comparisons(FAILURE_MESSAGE_FOR_TO)
end
match?(compare_object) click to toggle source
# File lib/rtest/equal.rb, line 13
def match?(compare_object)
  @compare_object = compare_object
  @match_object == @compare_object
end
success_message_for_not_to() click to toggle source
# File lib/rtest/equal.rb, line 30
def success_message_for_not_to
  SUCCESS_MESSAGE_FOR_NOT_TO
end
success_message_for_to() click to toggle source
# File lib/rtest/equal.rb, line 26
def success_message_for_to
  SUCCESS_MESSAGE_FOR_TO
end

Private Instance Methods

substitute_comparisons(message) click to toggle source
# File lib/rtest/equal.rb, line 35
def substitute_comparisons(message)
  message = message.sub(/{match}/, @match_object.to_s)
  message.sub(/{compare}/, @compare_object.to_s)
end