Created
November 10, 2014 15:22
-
-
Save anonymous/e4706ef39e5e3feadfc8 to your computer and use it in GitHub Desktop.
minitest not capturing IO
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 'singleton' | |
class TestIO | |
include Singleton | |
self.instance | |
def self.pwd | |
puts Dir.pwd | |
end | |
def self.pwd_works | |
Dir.pwd | |
end | |
end | |
require 'minitest/autorun' | |
describe TestIO do | |
describe "when we request current working dir" do | |
it "must return the current working dir" do | |
expected = Dir.pwd | |
actual = TestIO.pwd | |
assert_output(expected) { print actual } | |
end | |
end | |
describe "when we request current working dir" do | |
it "must return the current working dir" do | |
expected = Dir.pwd | |
actual = TestIO.pwd_works | |
assert_output(expected) { print actual } | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment