Method: Test::Unit::Assertions#assert_operator

Defined in:
lib/test/unit/assertions.rb

#assert_operator(object1, operator, object2, message = "") ⇒ Object



434
435
436
437
438
439
440
441
442
443
444
445
# File 'lib/test/unit/assertions.rb', line 434

def assert_operator(object1, operator, object2, message="")
  _wrap_assertion do
    full_message = build_message(nil, "<?>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
    assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
    full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
<?> expected to be
?
<?>.
EOT
    assert_block(full_message) { object1.__send__(operator, object2) }
  end
end