1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
describe "$stdin" do before :each do @stdin, $stdin = $stdin, IOStub("foo\nbar\n") end after :each do $stdin = @stdin end it "can be replaced" do gets == "foo\n" end end |
Pastie
Show Pastie some love
or read my new blog
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
describe "$stdin" do before :each do @stdin, $stdin = $stdin, IOStub("foo\nbar\n") end after :each do $stdin = @stdin end it "can be replaced" do gets == "foo\n" end end |