mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
assertions.rb: private flag
* lib/test/unit/assertions.rb (assert_respond_to): accept optional include-private flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
120e2219f3
commit
49a22e173b
1 changed files with 7 additions and 1 deletions
|
@ -250,7 +250,13 @@ EOT
|
|||
#
|
||||
# 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
|
||||
|
|
Loading…
Reference in a new issue