From: mame@... Date: 2017-11-27T07:29:37+00:00 Subject: [ruby-core:83886] [Ruby trunk Feature#3219][Rejected] assert now passes non-boolean result Issue #3219 has been updated by mame (Yusuke Endoh). Status changed from Assigned to Rejected I don't remember this ticket, but I guess this request should be handled in [the upstream of test/unit](https://github.com/test-unit/test-unit). (Or, if you want to change `test/lib/minitest`, please change freely.) ---------------------------------------- Feature #3219: assert now passes non-boolean result https://bugs.ruby-lang.org/issues/3219#change-67924 * Author: nobu (Nobuyoshi Nakada) * Status: Rejected * Priority: Normal * Assignee: sorah (Sorah Fukumori) * Target version: next minor ---------------------------------------- Hi, Test::Unit::Assertions#assert now passes non-boolean values (neither true nor false). It is not only an incompatibility against former TestUnit, also makes wrong tests (e.g., [ruby-core:29861]) passing. ``` diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index 821faf5..52d5201 100644 --- a/lib/test/unit/assertions.rb +++ b/lib/test/unit/assertions.rb @@ -10,6 +10,16 @@ module Test obj.pretty_inspect.chomp end + def assert(result, *args, &b) + super(result == true || result == false, "assertion result must be true or false") + super + end + + def refute(result, *args, &b) + super(result == true || result == false, "assertion result must be true or false") + super + end + def assert_raise(*args, &b) assert_raises(*args, &b) end ``` -- Nobu Nakada -- https://bugs.ruby-lang.org/ Unsubscribe: