ruby-changes:27690
From: nobu <ko1@a...>
Date: Wed, 13 Mar 2013 14:51:39 +0900 (JST)
Subject: [ruby-changes:27690] nobu:r39742 (trunk): assertions.rb: private flag
nobu 2013-03-13 14:51:29 +0900 (Wed, 13 Mar 2013) New Revision: 39742 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39742 Log: assertions.rb: private flag * lib/test/unit/assertions.rb (assert_respond_to): accept optional include-private flag. Modified files: trunk/lib/test/unit/assertions.rb Index: lib/test/unit/assertions.rb =================================================================== --- lib/test/unit/assertions.rb (revision 39741) +++ lib/test/unit/assertions.rb (revision 39742) @@ -250,7 +250,13 @@ EOT https://github.com/ruby/ruby/blob/trunk/lib/test/unit/assertions.rb#L250 # # assert_respond_to("hello", :reverse) #Succeeds # assert_respond_to("hello", :does_not_exist) #Fails - def assert_respond_to obj, meth, msg = nil + def assert_respond_to obj, (meth, priv), msg = nil + if priv + msg = message(msg) { + "Expected #{mu_pp(obj)} (#{obj.class}) to respond to ##{meth}#{" privately" if priv}" + } + return assert obj.respond_to?(meth, priv), msg + end #get rid of overcounting super if !caller[0].rindex(MINI_DIR, 0) || !obj.respond_to?(meth) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/