aruba 0.2.8 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +12 -1
- data/README.rdoc +17 -1
- data/aruba.gemspec +1 -1
- data/features/output.feature +24 -10
- data/lib/aruba/api.rb +10 -3
- data/lib/aruba/cucumber.rb +4 -0
- data/lib/aruba/process.rb +23 -11
- metadata +7 -7
data/History.txt
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
==
|
1
|
+
== 0.3.0
|
2
|
+
|
3
|
+
=== Bugfixes
|
4
|
+
* Remove latency introduced in the 0.2.8 release (#42 Mike Sassak)
|
5
|
+
|
6
|
+
=== New Features
|
7
|
+
* New stepdef Then /^the stdout should contain:$/ do |partial_output| (Aslak Hellesøy)
|
8
|
+
|
9
|
+
=== Changed Features
|
10
|
+
* Quotes (") and newline (\n) in step arguments no longer need to be backslash-escaped. (Aslak Hellesøy)
|
11
|
+
|
12
|
+
== 0.2.8
|
2
13
|
|
3
14
|
=== New Features
|
4
15
|
* Replaced background_process with childprocess, a cross-platform process control library. This will allow Aruba to run on Windows and JRuby in addition to *nix MRI. (#16, #27, #31 Mike Sassak, Jari Bakken, Matt Wynne, Arve Knudsen)
|
data/README.rdoc
CHANGED
@@ -26,7 +26,7 @@ Aruba has several tags you can use to get more information. You can put these ta
|
|
26
26
|
* <tt>@announce-env</tt> - See environment variables set by Aruba
|
27
27
|
* <tt>@announce</tt> - Does all of the above
|
28
28
|
|
29
|
-
==
|
29
|
+
== Runtime Configuration
|
30
30
|
|
31
31
|
Per default Aruba will create a directory <tt>tmp/aruba</tt> where it performs it's file operations.
|
32
32
|
If you want to change this behaviour put this into your <tt>features/support/env.rb</tt>:
|
@@ -35,6 +35,22 @@ If you want to change this behaviour put this into your <tt>features/support/env
|
|
35
35
|
@dirs = ["somewhere/else"]
|
36
36
|
end
|
37
37
|
|
38
|
+
Set <tt>@aruba_timeout_seconds</tt> to control the amount of time Aruba will wait for a process to
|
39
|
+
finish running before terminating it:
|
40
|
+
|
41
|
+
Before do
|
42
|
+
@aruba_timeout_seconds = 5
|
43
|
+
end
|
44
|
+
|
45
|
+
Running processes interactively can result in race conditions when Aruba executes an IO-related step
|
46
|
+
but the interactive process has not yet flushed or read some content. To help prevent this Aruba waits
|
47
|
+
before reading or writing to the process if it is still running. You can control the wait by setting
|
48
|
+
<tt>@aruba_io_wait_seconds</tt> to an appropriate value. This is particularly useful with tags:
|
49
|
+
|
50
|
+
Before('@slow_process') do
|
51
|
+
@aruba_io_wait_seconds = 5
|
52
|
+
end
|
53
|
+
|
38
54
|
== Note on Patches/Pull Requests
|
39
55
|
|
40
56
|
* Fork the project.
|
data/aruba.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'aruba'
|
5
|
-
s.version = '0.
|
5
|
+
s.version = '0.3.0'
|
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}"
|
data/features/output.feature
CHANGED
@@ -42,7 +42,7 @@ Feature: Output
|
|
42
42
|
Then the output should contain exactly "hello world\n"
|
43
43
|
|
44
44
|
Scenario: Detect exact multiline output
|
45
|
-
When I run "ruby -e 'puts
|
45
|
+
When I run "ruby -e 'puts "hello\nworld"'"
|
46
46
|
Then the output should contain exactly:
|
47
47
|
"""
|
48
48
|
hello
|
@@ -58,7 +58,7 @@ Feature: Output
|
|
58
58
|
|
59
59
|
@announce
|
60
60
|
Scenario: Detect subset of multiline output with regex
|
61
|
-
When I run "ruby -e 'puts
|
61
|
+
When I run "ruby -e 'puts "hello\nworld\nextra line1\nextra line2\nimportant line"'"
|
62
62
|
Then the output should match:
|
63
63
|
"""
|
64
64
|
he..o
|
@@ -69,14 +69,14 @@ Feature: Output
|
|
69
69
|
|
70
70
|
@announce
|
71
71
|
Scenario: Match passing exit status and partial output
|
72
|
-
When I run "ruby -e 'puts
|
72
|
+
When I run "ruby -e 'puts "hello\nworld"'"
|
73
73
|
Then it should pass with:
|
74
74
|
"""
|
75
75
|
hello
|
76
76
|
"""
|
77
77
|
|
78
78
|
Scenario: Match passing exit status and exact output
|
79
|
-
When I run "ruby -e 'puts
|
79
|
+
When I run "ruby -e 'puts "hello\nworld"'"
|
80
80
|
Then it should pass with exactly:
|
81
81
|
"""
|
82
82
|
hello
|
@@ -93,7 +93,7 @@ Feature: Output
|
|
93
93
|
"""
|
94
94
|
|
95
95
|
Scenario: Match failing exit status and exact output
|
96
|
-
When I run "ruby -e 'puts
|
96
|
+
When I run "ruby -e 'puts "hello\nworld";exit 99'"
|
97
97
|
Then it should fail with exactly:
|
98
98
|
"""
|
99
99
|
hello
|
@@ -115,11 +115,25 @@ Feature: Output
|
|
115
115
|
Then the stdout should contain "hello"
|
116
116
|
Then the stderr should not contain "hello"
|
117
117
|
|
118
|
-
@announce
|
119
|
-
Scenario: Match output
|
120
|
-
When I run "ruby -e '
|
121
|
-
Then the
|
122
|
-
|
118
|
+
@announce
|
119
|
+
Scenario: Match output on several lines
|
120
|
+
When I run "ruby -e 'puts %{GET /}'"
|
121
|
+
Then the stdout should contain:
|
122
|
+
"""
|
123
|
+
GET /
|
124
|
+
"""
|
125
|
+
|
126
|
+
Scenario: Match output on several lines using quotes
|
127
|
+
When I run "ruby -e 'puts %{GET "/"}'"
|
128
|
+
Then the stdout should contain:
|
129
|
+
"""
|
130
|
+
GET "/"
|
131
|
+
"""
|
132
|
+
|
133
|
+
Scenario: Match output in stdout
|
134
|
+
When I run "ruby -e 'puts \"hello\\nworld\"'"
|
135
|
+
Then the stdout should contain "hello"
|
136
|
+
Then the stderr should not contain "hello"
|
123
137
|
|
124
138
|
Scenario: Detect output from all processes
|
125
139
|
When I run "ruby -e 'puts \"hello world!\"'"
|
data/lib/aruba/api.rb
CHANGED
@@ -98,7 +98,8 @@ module Aruba
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def unescape(string)
|
101
|
-
|
101
|
+
string.gsub('\n', "\n")
|
102
|
+
.gsub('\"', '"')
|
102
103
|
end
|
103
104
|
|
104
105
|
def regexp(string_or_regexp)
|
@@ -195,7 +196,7 @@ module Aruba
|
|
195
196
|
announce_or_puts("$ cd #{Dir.pwd}") if @announce_dir
|
196
197
|
announce_or_puts("$ #{cmd}") if @announce_cmd
|
197
198
|
|
198
|
-
process = processes[cmd] = Process.new(cmd,
|
199
|
+
process = processes[cmd] = Process.new(cmd, exit_timeout, io_wait)
|
199
200
|
process.run!
|
200
201
|
|
201
202
|
block_given? ? yield(process) : process
|
@@ -204,10 +205,16 @@ module Aruba
|
|
204
205
|
|
205
206
|
DEFAULT_TIMEOUT_SECONDS = 1
|
206
207
|
|
207
|
-
def
|
208
|
+
def exit_timeout
|
208
209
|
@aruba_timeout_seconds || DEFAULT_TIMEOUT_SECONDS
|
209
210
|
end
|
210
211
|
|
212
|
+
DEFAULT_IO_WAIT_SECONDS = 0.1
|
213
|
+
|
214
|
+
def io_wait
|
215
|
+
@aruba_io_wait_seconds || DEFAULT_IO_WAIT_SECONDS
|
216
|
+
end
|
217
|
+
|
211
218
|
def run_simple(cmd, fail_on_error=true)
|
212
219
|
@last_exit_status = run(cmd) do |process|
|
213
220
|
process.stop
|
data/lib/aruba/cucumber.rb
CHANGED
@@ -188,6 +188,10 @@ Then /^the stdout should contain "([^"]*)"$/ do |partial_output|
|
|
188
188
|
all_stdout.should include(unescape(partial_output))
|
189
189
|
end
|
190
190
|
|
191
|
+
Then /^the stdout should contain:$/ do |partial_output|
|
192
|
+
all_stdout.should include(unescape(partial_output))
|
193
|
+
end
|
194
|
+
|
191
195
|
Then /^the stdout should contain exactly:$/ do |exact_output|
|
192
196
|
all_stdout.should == exact_output
|
193
197
|
end
|
data/lib/aruba/process.rb
CHANGED
@@ -6,8 +6,10 @@ module Aruba
|
|
6
6
|
class Process
|
7
7
|
include Shellwords
|
8
8
|
|
9
|
-
def initialize(cmd,
|
10
|
-
@
|
9
|
+
def initialize(cmd, exit_timeout, io_wait)
|
10
|
+
@exit_timeout = exit_timeout
|
11
|
+
@io_wait = io_wait
|
12
|
+
|
11
13
|
@out = Tempfile.new("aruba-out")
|
12
14
|
@err = Tempfile.new("aruba-err")
|
13
15
|
@process = ChildProcess.build(*shellwords(cmd))
|
@@ -22,8 +24,9 @@ module Aruba
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def stdin
|
25
|
-
|
26
|
-
|
27
|
+
wait_for_io do
|
28
|
+
@process.io.stdin
|
29
|
+
end
|
27
30
|
end
|
28
31
|
|
29
32
|
def output
|
@@ -31,23 +34,32 @@ module Aruba
|
|
31
34
|
end
|
32
35
|
|
33
36
|
def stdout
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
wait_for_io do
|
38
|
+
@out.rewind
|
39
|
+
@out.read
|
40
|
+
end
|
37
41
|
end
|
38
42
|
|
39
43
|
def stderr
|
40
|
-
|
41
|
-
|
42
|
-
|
44
|
+
wait_for_io do
|
45
|
+
@err.rewind
|
46
|
+
@err.read
|
47
|
+
end
|
43
48
|
end
|
44
49
|
|
45
50
|
def stop
|
46
51
|
if @process
|
47
52
|
stdout && stderr # flush output
|
48
|
-
@process.poll_for_exit(@
|
53
|
+
@process.poll_for_exit(@exit_timeout)
|
49
54
|
@process.exit_code
|
50
55
|
end
|
51
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def wait_for_io(&block)
|
61
|
+
sleep @io_wait if @process.alive?
|
62
|
+
yield
|
63
|
+
end
|
52
64
|
end
|
53
65
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 0.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Aslak Helles\xC3\xB8y"
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-12-
|
19
|
+
date: 2010-12-28 00:00:00 -06:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
112
|
requirements:
|
113
113
|
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
hash: -
|
115
|
+
hash: -686975627344897443
|
116
116
|
segments:
|
117
117
|
- 0
|
118
118
|
version: "0"
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
hash: -
|
124
|
+
hash: -686975627344897443
|
125
125
|
segments:
|
126
126
|
- 0
|
127
127
|
version: "0"
|
@@ -131,7 +131,7 @@ rubyforge_project:
|
|
131
131
|
rubygems_version: 1.3.7
|
132
132
|
signing_key:
|
133
133
|
specification_version: 3
|
134
|
-
summary: aruba-0.
|
134
|
+
summary: aruba-0.3.0
|
135
135
|
test_files:
|
136
136
|
- features/exit_statuses.feature
|
137
137
|
- features/file_system_commands.feature
|