diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index 6e4707fc25..ab3dd83aaa 100644 --- a/lib/test/unit/assertions.rb +++ b/lib/test/unit/assertions.rb @@ -10,10 +10,12 @@ module Test obj.pretty_inspect.chomp end - def assert(test, msg = (nomsg = true; nil)) - unless nomsg or msg.instance_of?(String) or msg.instance_of?(Proc) or - (bt = caller).first.rindex(MiniTest::MINI_DIR, 0) - bt.delete_if {|s| s.rindex(MiniTest::MINI_DIR, 0)} + UNASSIGNED = Object.new # :nodoc: + + def assert(test, msg = UNASSIGNED) + msg = nil if msg == UNASSIGNED + unless String === msg or Proc === msg then + bt = caller.reject { |s| s.rindex(MiniTest::MINI_DIR, 0) } raise ArgumentError, "assertion message must be String or Proc, but #{msg.class} was given.", bt end super