1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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