Skip to content

Commit

Permalink
Improved test_stub_callable_keyword_args to test pass-through.
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//src/minitest/dev/": change = 13022]
  • Loading branch information
zenspider committed Feb 15, 2021
1 parent 8a7ba81 commit 13c48a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/minitest/mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ class Object
# assert obj_under_test.stale?
# end
# end
#
#--
# NOTE: keyword args in callables are NOT checked for correctness
# against the existing method. Too many edge cases to be worth it.

def stub name, val_or_callable, *block_args
new_name = "__minitest_stub__#{name}"
Expand Down
4 changes: 2 additions & 2 deletions test/minitest/test_minitest_mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ def self.args req, kw1:, kw2:24
end

def test_stub_callable_keyword_args
Keywords.stub :args, ->(*args, **kws) { 42 } do
@tc.assert_equal 42, Keywords.args("woot", kw1:314)
Keywords.stub :args, ->(*args, **kws) { [args, kws] } do
@tc.assert_equal [["woot"], { kw1: 42 }], Keywords.args("woot", kw1: 42)
end
end

Expand Down

0 comments on commit 13c48a0

Please sign in to comment.