Skip to content

Instantly share code, notes, and snippets.

View baweaver's full-sized avatar
📝
Documenting things

Brandon Weaver baweaver

📝
Documenting things
View GitHub Profile
@nu7hatch
nu7hatch / spec_helper.rb
Created October 17, 2010 21:46
Testing standard input with RSpec
...
module Helpers
# Replace standard input with faked one StringIO.
def fake_stdin(*args)
begin
$stdin = StringIO.new
$stdin.puts(args.shift) until args.empty?
$stdin.rewind
yield