Sha256: 3c15a2f7d87b87930f008854cc9f56a8ef7970ef2d4399824516cb021ab741c0

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 Bytes

Contents

Given /^I have a new subprocess that takes a long time to run$/ do 
  @popen = Subprocess::Popen.new('sleep 3 && exit 1')
  @popen.should_not be_nil
end

When /^I invoke the run method of said nonblocking subprocess$/ do
  start_time = Time.now.to_i
  @popen.run
  @total_time = Time.now.to_i - start_time
end

Then /^the subprocess should not block$/ do
  # this should pass if we backgrounded cause it shouldn't take more than 
  # 1 second to get here but the command should take 3 seconds to run
  @total_time.should be_close(0, 2) 
end

Then /^the subprocess should report its run status$/ do
  @popen.should respond_to(:running?)
end

Then /^the subprocess should support being waited on till complete$/ do
  @popen.wait
  @popen.status[:exitstatus].should be_kind_of Numeric
end

Then /^the subprocess should have status info$/ do
  @popen.status.should be_a_kind_of Hash
end



Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
subprocess-0.1.6 features/step_definitions/popen_without_blocking_steps.rb