require 'spec/spec_helper'
require 'pp'
describe "$stdin" do
before :each do
@stdin, $stdin = $stdin, IOStub.new("foo\nbar\n")
end
after :each do
$stdin = @stdin
end
it "can be replaced" do
gets.should == "foo\n"
end
end
Pastie
Support Pastie
or read my
Pastie << self
blog
require 'spec/spec_helper'
require 'pp'
describe "$stdin" do
before :each do
@stdin, $stdin = $stdin, IOStub.new("foo\nbar\n")
end
after :each do
$stdin = @stdin
end
it "can be replaced" do
gets.should == "foo\n"
end
end