aruba 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -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
data/aruba.gemspec CHANGED
@@ -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'
@@ -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'"
@@ -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
data/lib/aruba/api.rb CHANGED
@@ -196,19 +196,26 @@ module Aruba
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}")
@@ -181,7 +181,7 @@ Then /^the stderr should contain "([^"]*)"$/ do |partial_output|
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 @@ Then /^the stdout should contain "([^"]*)"$/ do |partial_output|
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|
data/lib/aruba/process.rb CHANGED
@@ -2,8 +2,9 @@ require 'background_process'
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 @@ module Aruba
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
metadata CHANGED
@@ -5,12 +5,13 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 5
9
- version: 0.2.5
8
+ - 6
9
+ version: 0.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Aslak Helles\xC3\xB8y"
13
13
  - David Chelimsky
14
+ - Mike Sassak
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
@@ -109,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
110
  requirements:
110
111
  - - ">="
111
112
  - !ruby/object:Gem::Version
112
- hash: 1671730072629991587
113
+ hash: -1582580386571401091
113
114
  segments:
114
115
  - 0
115
116
  version: "0"
@@ -118,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
119
  requirements:
119
120
  - - ">="
120
121
  - !ruby/object:Gem::Version
121
- hash: 1671730072629991587
122
+ hash: -1582580386571401091
122
123
  segments:
123
124
  - 0
124
125
  version: "0"
@@ -128,7 +129,7 @@ rubyforge_project:
128
129
  rubygems_version: 1.3.7
129
130
  signing_key:
130
131
  specification_version: 3
131
- summary: aruba-0.2.5
132
+ summary: aruba-0.2.6
132
133
  test_files:
133
134
  - features/exit_statuses.feature
134
135
  - features/file_system_commands.feature