Sha256: 622d20d939dfd269da1a2a0b813d9ea2ac96d5f8c173bc6b7e5afea91dd80fb3
Contents?: true
Size: 848 Bytes
Versions: 1
Compression:
Stored size: 848 Bytes
Contents
require 'open3' @interactive_history = [] def run_interactive_program old_dir = Dir.pwd Dir.chdir("tmp/aruba") unless Dir.pwd.split('/')[-1] == "aruba" @stdin, @stdout, @stderr = Open3.popen3(@interactive_prog) @interactive_history.each do |input| @stdin.puts input end @output = "" begin loop do Timeout::timeout(1) do @output << @stdout.readpartial(1) end end rescue Timeout::Error rescue EOFError end Dir.chdir(old_dir) end When /^I run "([^\"]*)" interactively$/ do |arg1| @interactive_prog = arg1 @interactive_history = [] end Then /^the program should prompt "([^\"]*)"$/ do |arg1| run_interactive_program @output.should include(arg1) end When /^I type "([^\"]*)"/ do |arg1| @interactive_history << arg1 end When /^the program completes$/ do run_interactive_program end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
my-0.3.0 | features/support/interactive_steps.rb |