Skip to content

Instantly share code, notes, and snippets.

Created November 10, 2014 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e4706ef39e5e3feadfc8 to your computer and use it in GitHub Desktop.
Save anonymous/e4706ef39e5e3feadfc8 to your computer and use it in GitHub Desktop.
minitest not capturing IO
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