Created
August 26, 2011 12:23
-
-
Save acook/1173299 to your computer and use it in GitHub Desktop.
A spec_helper to assist in testing executable file behaviour, assumes your Gemfile includes the Open4 gem.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler' | |
Bundler.require(:test) | |
def run(*args) | |
output = Struct.new(:pid, :stdout, :stderr) | |
status = Open4.popen4(*args) do |pid, stdin, stdout, stderr| | |
output = output.new pid, stdout.read, stderr.read | |
end | |
[status, output] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment