Why does this print something?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'minitest/autorun' | |
| module Kernel | |
| def sleep(n) | |
| puts "calling sleep" | |
| end | |
| end | |
| describe "stub" do | |
| it "stubs stuff" do | |
| Kernel.stub(:sleep, nil) do | |
| sleep(5) | |
| end | |
| end | |
| end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ruby bug.rb | |
| Run options: --seed 13072 | |
| # Running tests: | |
| calling sleep | |
| . | |
| Finished tests in 0.001058s, 945.1796 tests/s, 0.0000 assertions/s. | |
| 1 tests, 0 assertions, 0 failures, 0 errors, 0 skips | |
| steve at thoth-2 in ~/tmp | |
| $ ruby -v | |
| ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0] | |
| steve at thoth-2 in ~/tmp | |
| $ gem list minitest | |
| *** LOCAL GEMS *** | |
| minitest (4.7.0, 4.6.2, 4.6.1, 4.6.0, 4.3.3, 4.3.2) | |
| minitest-rails (0.3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment