Skip to content
This repository
  • 2 commits
  • 7 files changed
  • 1 comment
  • 1 contributor
8 History.txt
... ... @@ -1,3 +1,11 @@
  1 +== 0.2.6
  2 +
  3 +=== New Features
  4 +* You can set @aruba_timeout_seconds in a Before hook to tell Aruba to wait for a process to complete. Default: 1 second. (Aslak Hellesøy)
  5 +
  6 +=== Bug fixes
  7 +* Fixed small bug in /^the stdout should contain exactly:$/ (Aslak Hellesøy)
  8 +
1 9 == 0.2.5
2 10
3 11 === New Features
4 aruba.gemspec
@@ -2,8 +2,8 @@
2 2
3 3 Gem::Specification.new do |s|
4 4 s.name = 'aruba'
5   - s.version = "0.2.5"
6   - s.authors = ["Aslak Hellesøy", "David Chelimsky"]
  5 + s.version = "0.2.6"
  6 + s.authors = ["Aslak Hellesøy", "David Chelimsky", "Mike Sassak"]
7 7 s.description = 'CLI Steps for Cucumber, hand-crafted for you in Aruba'
8 8 s.summary = "aruba-#{s.version}"
9 9 s.email = 'cukes@googlegroups.com'
4 features/exit_statuses.feature
@@ -7,6 +7,10 @@ Feature: exit statuses
7 7 Scenario: exit status of 0
8 8 When I run "ruby -h"
9 9 Then the exit status should be 0
  10 +
  11 + Scenario: Not explicitly exiting at all
  12 + When I run "ruby -e '42'"
  13 + Then the exit status should be 0
10 14
11 15 Scenario: non-zero exit status
12 16 When I run "ruby -e 'exit 56'"
7 features/flushing.feature
@@ -4,10 +4,17 @@ Feature: Flushing output
4 4 As a developer using Aruba
5 5 I want to make sure that large amounts of output aren't buffered
6 6
  7 + Scenario: A little output
  8 + When I run "ruby -e 'puts :a.to_s * 256'"
  9 + Then the output should contain "a"
  10 + And the output should be 256 bytes long
  11 + And the exit status should be 0
  12 +
7 13 Scenario: Tons of output
8 14 When I run "ruby -e 'puts :a.to_s * 65536'"
9 15 Then the output should contain "a"
10 16 And the output should be 65536 bytes long
  17 + # And the exit status should be 0
11 18
12 19 Scenario: Tons of interactive output
13 20 When I run "ruby -e 'len = gets.chomp; puts :a.to_s * len.to_i'" interactively
9 lib/aruba/api.rb
@@ -196,19 +196,26 @@ def run(cmd)
196 196 announce_or_puts("$ cd #{Dir.pwd}") if @announce_dir
197 197 announce_or_puts("$ #{cmd}") if @announce_cmd
198 198
199   - process = processes[cmd] = Process.new(cmd)
  199 + process = processes[cmd] = Process.new(cmd, timeout)
200 200 process.run!
201 201
202 202 block_given? ? yield(process) : process
203 203 end
204 204 end
205 205
  206 + DEFAULT_TIMEOUT_SECONDS = 1
  207 +
  208 + def timeout
  209 + @aruba_timeout_seconds || DEFAULT_TIMEOUT_SECONDS
  210 + end
  211 +
206 212 def run_simple(cmd, fail_on_error=true)
207 213 @last_exit_status = run(cmd) do |process|
208 214 announce_or_puts(process.stdout) if @announce_stdout
209 215 announce_or_puts(process.stderr) if @announce_stderr
210 216 process.stop
211 217 end
  218 + @timed_out = @last_exit_status.nil?
212 219
213 220 if(@last_exit_status != 0 && fail_on_error)
214 221 fail("Exit status was #{@last_exit_status}. Output:\n#{all_output}")
4 lib/aruba/cucumber.rb
@@ -181,7 +181,7 @@
181 181 end
182 182
183 183 Then /^the stderr should contain exactly:$/ do |exact_output|
184   - @last_stderr.should == exact_output
  184 + all_stderr.should == exact_output
185 185 end
186 186
187 187 Then /^the stdout should contain "([^"]*)"$/ do |partial_output|
@@ -189,7 +189,7 @@
189 189 end
190 190
191 191 Then /^the stdout should contain exactly:$/ do |exact_output|
192   - @stdout.should == exact_output
  192 + all_stdout.should == exact_output
193 193 end
194 194
195 195 Then /^the stderr should not contain "([^"]*)"$/ do |partial_output|
5 lib/aruba/process.rb
@@ -2,8 +2,9 @@
2 2
3 3 module Aruba
4 4 class Process
5   - def initialize(cmd)
  5 + def initialize(cmd, timeout)
6 6 @cmd = cmd
  7 + @timeout = timeout
7 8 end
8 9
9 10 def run!(&block)
@@ -37,7 +38,7 @@ def stderr
37 38
38 39 def stop
39 40 if @process
40   - status = @process.wait(1)
  41 + status = @process.wait(@timeout)
41 42 status && status.exitstatus
42 43 end
43 44 end

Showing you all comments on commits in this comparison.

James B. Byrne

The flushing error caused me to implement timeouts on my own fork. I shortly thereafter discovered that anything less than 20 seconds resulted in every significantly process intensive test timing out. This on a 64bit quad core. YMMV as they say.

Something went wrong with that request. Please try again.