Skip to content

Commit

Permalink
Add stub test for public module method that was private
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcgibbon authored and zenspider committed Oct 19, 2022
1 parent 4accdd5 commit 0a65d0b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/minitest/test_minitest_mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,20 @@ def test_stub_public_module_method
end
end

def test_stub_public_module_method_that_was_private
console = Module.new do
class << self
public :system
end
end

console.stub(:system, "some command") do
console.system("some command")
end

@tc.assert_respond_to(console, :system)
end

def test_stub_value
assert_stub 42
end
Expand Down

0 comments on commit 0a65d0b

Please sign in to comment.