Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
rspec I/O for a ruby script
require 'open3'
describe 'my_script' do
def run *args
options = args.extract_options!
args.unshift './my_script'
Open3.popen3(args.join(' ')) do |i, o, e|
i.write options[:stdin]
i.close
[o, e].map{|pipe|pipe.read.strip}
end
end
it "should echo STDIN" do
out, err = run :stdin => 'foo'
out.should == 'foo'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.