Created
August 4, 2008 18:39
-
-
Save febuiles/3948 to your computer and use it in GitHub Desktop.
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 File.dirname(__FILE__) + '/../../spec_helper' | |
require File.dirname(__FILE__) + '/fixtures/classes' | |
describe "IO#<<" do | |
it "writes an object to the IO stream" do | |
lambda { | |
$stderr << "Oh noes, an error!" | |
}.should output_to_fd("Oh noes, an error!", STDERR) | |
end | |
it "calls #to_s on the object to print it" do | |
lambda { | |
$stderr << 1337 | |
}.should output_to_fd("1337", STDERR) | |
p STDERR.closed? | |
end | |
it "raises an error if the stream is closed" do | |
io = IOSpecs.closed_file | |
lambda { io << "test" }.should raise_error(IOError) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment