diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-07 03:56:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-07 03:56:15 +0000 |
commit | 0cd8d9714a744517d12ceb11a4a497093efc2397 (patch) | |
tree | ea7afd5cbcbe0ee503b9ab015daceb7a5a8c4f7d /test | |
parent | 2e84bbd441c3069ae6f7103455abe5c90b767e73 (diff) | |
download | ruby-0cd8d9714a744517d12ceb11a4a497093efc2397.tar.gz |
assert_respond_to non-private method
* test/lib/test/unit/assertions.rb (assert_respond_to): do not
call super class assert_respond_to when false priv is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/test/unit/assertions.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb index 7a16be2ed9..c98e1ade58 100644 --- a/test/lib/test/unit/assertions.rb +++ b/test/lib/test/unit/assertions.rb @@ -361,15 +361,18 @@ EOT # # assert_respond_to("hello", :reverse) #Succeeds # assert_respond_to("hello", :does_not_exist) #Fails - def assert_respond_to obj, (meth, priv), msg = nil - if priv + def assert_respond_to(obj, (meth, *priv), msg = nil) + unless priv.empty? msg = message(msg) { - "Expected #{mu_pp(obj)} (#{obj.class}) to respond to ##{meth}#{" privately" if priv}" + "Expected #{mu_pp(obj)} (#{obj.class}) to respond to ##{meth}#{" privately" if priv[0]}" } - return assert obj.respond_to?(meth, priv), msg + 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) + if caller_locations(1, 1)[0].path.start_with?(MINI_DIR) + return if obj.respond_to?(meth) + end + super(obj, meth, msg) end # :call-seq: |