Permalink
Browse files

Sharpen stub tests. (ab9)

[git-p4: depot-paths = "//src/minitest/dev/": change = 8463]
  • Loading branch information...
1 parent 2e06cd4 commit c7c620bbfb9158055f3ceca169ea0f0d739df6fc @zenspider zenspider committed Apr 25, 2013
Showing with 8 additions and 8 deletions.
  1. +8 −8 test/minitest/test_minitest_mock.rb
@@ -315,22 +315,22 @@ def test_stub_private_module_method
def test_stub_private_module_method_indirect
@assertion_count += 1
- slow_clapper = Class.new do
- def slow_clap
- sleep 3
+ fail_clapper = Class.new do
+ def fail_clap
+ fail
:clap
end
end.new
- slow_clapper.stub :sleep, nil do |fast_clapper|
- @tc.assert_equal :clap, fast_clapper.slow_clap # either form works
- @tc.assert_equal :clap, slow_clapper.slow_clap # yay closures
+ fail_clapper.stub :fail, nil do |safe_clapper|
+ @tc.assert_equal :clap, safe_clapper.fail_clap # either form works
+ @tc.assert_equal :clap, fail_clapper.fail_clap # yay closures
end
end
def test_stub_public_module_method
- Math.stub(:log10, 42.0) do
- @tc.assert_in_delta 42.0, Math.log10(1000)
+ Math.stub :log10, :stubbed do
+ @tc.assert_equal :stubbed, Math.log10(1000)
end
end

0 comments on commit c7c620b

Please sign in to comment.