Skip to content

Instantly share code, notes, and snippets.

@febuiles
Created August 4, 2008 18:39
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 febuiles/3948 to your computer and use it in GitHub Desktop.
Save febuiles/3948 to your computer and use it in GitHub Desktop.
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