aruba 0.2.4 → 0.2.5
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 +16 -1
- data/aruba.gemspec +2 -2
- data/cucumber.yml +2 -0
- data/features/exit_statuses.feature +4 -0
- data/features/file_system_commands.feature +21 -3
- data/features/flushing.feature +16 -0
- data/features/interactive.feature +8 -0
- data/features/output.feature +67 -0
- data/features/step_definitions/aruba_dev_steps.rb +10 -1
- data/lib/aruba/api.rb +79 -37
- data/lib/aruba/cucumber.rb +66 -14
- data/lib/aruba/process.rb +45 -0
- metadata +12 -8
data/History.txt
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
== 0.2.5
|
2
|
+
|
3
|
+
=== New Features
|
4
|
+
* Added 'a file named "whatever" should (not) exist' (Robert Speicher)
|
5
|
+
* Added 'a directory named "whatever" should (not) exist' (Robert Speicher)
|
6
|
+
* Added /^the stderr should contain exactly:"$/ (Aslak Hellesøy)
|
7
|
+
* Added /^the stdout should contain exactly:"$/ (Aslak Hellesøy)
|
8
|
+
* Added /it should pass with exactly:/ (Aslak Hellesøy)
|
9
|
+
* @announce, @announce-dir and @announce-cmd for interactive processes (Mike Sassak)
|
10
|
+
* Add step defs for detecting output, stdout and stderr by process name (Mike Sassak)
|
11
|
+
|
12
|
+
=== Bug fixes
|
13
|
+
* Stop all processes before verifying filesystem changes to ensure async operations are complete (#17 Mike Sassak)
|
14
|
+
* Outputting large amounts of data causes run steps to hang (#18 Mike Sassak)
|
15
|
+
|
1
16
|
== 0.2.4
|
2
17
|
|
3
18
|
=== New Features
|
@@ -97,4 +112,4 @@
|
|
97
112
|
* Better Regexp escaping (David Chelimsky)
|
98
113
|
|
99
114
|
== 0.1.0
|
100
|
-
* First release (David Chelimsky and Aslak Hellesøy)
|
115
|
+
* First release (David Chelimsky and Aslak Hellesøy)
|
data/aruba.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'aruba'
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.5"
|
6
6
|
s.authors = ["Aslak Hellesøy", "David Chelimsky"]
|
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'
|
10
10
|
s.homepage = 'http://github.com/aslakhellesoy/aruba'
|
11
11
|
|
12
|
-
s.add_dependency 'cucumber', '~> 0.9.
|
12
|
+
s.add_dependency 'cucumber', '~> 0.9.4'
|
13
13
|
s.add_dependency 'background_process' # Can't specify a version - bundler/rubygems chokes on '2.1'
|
14
14
|
s.add_development_dependency 'rspec', '~> 2.0.1'
|
15
15
|
|
data/cucumber.yml
ADDED
@@ -19,3 +19,7 @@ Feature: exit statuses
|
|
19
19
|
Scenario: Unsuccessfully run something
|
20
20
|
When I do aruba I successfully run "ruby -e 'exit 10'"
|
21
21
|
Then aruba should fail with "Exit status was 10"
|
22
|
+
|
23
|
+
Scenario: Try to run something that doesn't exist
|
24
|
+
When I run "does_not_exist"
|
25
|
+
Then the exit status should be 1
|
@@ -67,14 +67,21 @@ Feature: file system commands
|
|
67
67
|
Scenario: Check for absence of files
|
68
68
|
Then the following files should not exist:
|
69
69
|
| lorem/ipsum/dolor |
|
70
|
-
|
70
|
+
|
71
|
+
Scenario: Check for presence of a single file
|
72
|
+
Given an empty file named "lorem/ipsum/dolor"
|
73
|
+
Then a file named "lorem/ipsum/dolor" should exist
|
74
|
+
|
75
|
+
Scenario: Check for absence of a single file
|
76
|
+
Then a file named "lorem/ipsum/dolor" should not exist
|
77
|
+
|
71
78
|
Scenario: Check for presence of a subset of directories
|
72
79
|
Given a directory named "foo/bar"
|
73
80
|
Given a directory named "foo/bla"
|
74
81
|
Then the following directories should exist:
|
75
82
|
| foo/bar |
|
76
83
|
| foo/bla |
|
77
|
-
|
84
|
+
|
78
85
|
Scenario: check for absence of directories
|
79
86
|
Given a directory named "foo/bar"
|
80
87
|
Given a directory named "foo/bla"
|
@@ -84,7 +91,18 @@ Feature: file system commands
|
|
84
91
|
| foo/bar/ |
|
85
92
|
| foo/bla/ |
|
86
93
|
"""
|
87
|
-
|
94
|
+
|
95
|
+
Scenario: Check for presence of a single directory
|
96
|
+
Given a directory named "foo/bar"
|
97
|
+
Then a directory named "foo/bar" should exist
|
98
|
+
|
99
|
+
Scenario: Check for absence of a single directory
|
100
|
+
Given a directory named "foo/bar"
|
101
|
+
Then the following step should fail with Spec::Expectations::ExpectationNotMetError:
|
102
|
+
"""
|
103
|
+
Then a directory named "foo/bar" should not exist
|
104
|
+
"""
|
105
|
+
|
88
106
|
Scenario: Check file contents
|
89
107
|
Given a file named "foo" with:
|
90
108
|
"""
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Flushing output
|
2
|
+
|
3
|
+
In order to test processes that output a lot of data
|
4
|
+
As a developer using Aruba
|
5
|
+
I want to make sure that large amounts of output aren't buffered
|
6
|
+
|
7
|
+
Scenario: Tons of output
|
8
|
+
When I run "ruby -e 'puts :a.to_s * 65536'"
|
9
|
+
Then the output should contain "a"
|
10
|
+
And the output should be 65536 bytes long
|
11
|
+
|
12
|
+
Scenario: Tons of interactive output
|
13
|
+
When I run "ruby -e 'len = gets.chomp; puts :a.to_s * len.to_i'" interactively
|
14
|
+
And I type "65536"
|
15
|
+
Then the output should contain "a"
|
16
|
+
And the output should be 65536 bytes long
|
@@ -28,3 +28,11 @@ Feature: Interactive process control
|
|
28
28
|
"""
|
29
29
|
7
|
30
30
|
"""
|
31
|
+
|
32
|
+
Scenario: Stop processes before checking for filesystem changes
|
33
|
+
See: http://github.com/aslakhellesoy/aruba/issues#issue/17 for context
|
34
|
+
|
35
|
+
Given a directory named "rename_me"
|
36
|
+
When I run "mv rename_me renamed" interactively
|
37
|
+
Then a directory named "renamed" should exist
|
38
|
+
And a directory named "rename_me" should not exist
|
data/features/output.feature
CHANGED
@@ -75,6 +75,15 @@ Feature: Output
|
|
75
75
|
hello
|
76
76
|
"""
|
77
77
|
|
78
|
+
Scenario: Match passing exit status and exact output
|
79
|
+
When I run "ruby -e 'puts \"hello\\nworld\"'"
|
80
|
+
Then it should pass with exactly:
|
81
|
+
"""
|
82
|
+
hello
|
83
|
+
world
|
84
|
+
|
85
|
+
"""
|
86
|
+
|
78
87
|
@announce-stdout
|
79
88
|
Scenario: Match failing exit status and partial output
|
80
89
|
When I run "ruby -e 'puts \"hello\\nworld\";exit 99'"
|
@@ -83,6 +92,15 @@ Feature: Output
|
|
83
92
|
hello
|
84
93
|
"""
|
85
94
|
|
95
|
+
Scenario: Match failing exit status and exact output
|
96
|
+
When I run "ruby -e 'puts \"hello\\nworld\";exit 99'"
|
97
|
+
Then it should fail with exactly:
|
98
|
+
"""
|
99
|
+
hello
|
100
|
+
world
|
101
|
+
|
102
|
+
"""
|
103
|
+
|
86
104
|
@announce-stdout
|
87
105
|
Scenario: Match failing exit status and output with regex
|
88
106
|
When I run "ruby -e 'puts \"hello\\nworld\";exit 99'"
|
@@ -102,3 +120,52 @@ Feature: Output
|
|
102
120
|
When I run "ruby -e 'STDERR.puts \"hello\\nworld\";exit 99'"
|
103
121
|
Then the stderr should contain "hello"
|
104
122
|
Then the stdout should not contain "hello"
|
123
|
+
|
124
|
+
Scenario: Detect output from all processes
|
125
|
+
When I run "ruby -e 'puts \"hello world!\"'"
|
126
|
+
And I run "ruby -e 'puts gets.chomp.reverse'" interactively
|
127
|
+
And I type "hello"
|
128
|
+
Then the output should contain exactly:
|
129
|
+
"""
|
130
|
+
hello world!
|
131
|
+
olleh
|
132
|
+
|
133
|
+
"""
|
134
|
+
|
135
|
+
Scenario: Detect stdout from all processes
|
136
|
+
When I run "ruby -e 'puts \"hello world!\"'"
|
137
|
+
And I run "ruby -e 'puts gets.chomp.reverse'" interactively
|
138
|
+
And I type "hello"
|
139
|
+
Then the stdout should contain "hello world!\nolleh"
|
140
|
+
And the stderr should not contain "hello world!\nolleh"
|
141
|
+
|
142
|
+
Scenario: Detect stderr from all processes
|
143
|
+
When I run "ruby -e 'STDERR.puts \"hello world!\"'"
|
144
|
+
And I run "ruby -e 'STDERR.puts gets.chomp.reverse'" interactively
|
145
|
+
And I type "hello"
|
146
|
+
Then the stderr should contain "hello world!\nolleh"
|
147
|
+
And the stdout should not contain "hello world!\nolleh"
|
148
|
+
|
149
|
+
Scenario: Detect output from named source
|
150
|
+
When I run "ruby -e 'puts :simple'"
|
151
|
+
And I run "ruby -e 'puts gets.chomp'" interactively
|
152
|
+
And I type "interactive"
|
153
|
+
Then the output from "ruby -e 'puts :simple'" should contain "simple"
|
154
|
+
And the output from "ruby -e 'puts gets.chomp'" should not contain "simple"
|
155
|
+
|
156
|
+
Scenario: Detect stdout from named source
|
157
|
+
When I run "ruby -e 'puts :hello'"
|
158
|
+
And I run "ruby -e 'puts :goodbye'"
|
159
|
+
Then the stdout from "ruby -e 'puts :hello'" should contain "hello"
|
160
|
+
And the stderr from "ruby -e 'puts :hello'" should not contain "hello"
|
161
|
+
And the stdout from "ruby -e 'puts :goodbye'" should not contain "hello"
|
162
|
+
|
163
|
+
Scenario: Detect stderr from named source
|
164
|
+
When I run "ruby -e 'STDERR.puts :hello'"
|
165
|
+
And I run "ruby -e 'puts :goodbye'"
|
166
|
+
Then the stderr from "ruby -e 'STDERR.puts :hello'" should contain "hello"
|
167
|
+
And the stdout from "ruby -e 'STDERR.puts :hello'" should not contain "hello"
|
168
|
+
And the stderr from "ruby -e 'puts :goodbye'" should not contain "hello"
|
169
|
+
|
170
|
+
@wip
|
171
|
+
Scenario: Detect output from named source with custom name
|
@@ -6,10 +6,19 @@ When /^I do aruba (.*)$/ do |aruba_step|
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
+
# Useful for debugging timing problems
|
10
|
+
When /^sleep (\d+)$/ do |time|
|
11
|
+
sleep time.to_i
|
12
|
+
end
|
13
|
+
|
9
14
|
Then /^aruba should fail with "([^"]*)"$/ do |error_message|
|
10
|
-
@aruba_exception.message.should
|
15
|
+
@aruba_exception.message.should include(unescape(error_message))
|
11
16
|
end
|
12
17
|
|
13
18
|
Then /^the following step should fail with Spec::Expectations::ExpectationNotMetError:$/ do |multiline_step|
|
14
19
|
proc {steps multiline_step}.should raise_error(RSpec::Expectations::ExpectationNotMetError)
|
15
20
|
end
|
21
|
+
|
22
|
+
Then /^the output should be (\d+) bytes long$/ do |length|
|
23
|
+
all_output.chomp.length.should == length.to_i
|
24
|
+
end
|
data/lib/aruba/api.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'rbconfig'
|
3
|
-
|
3
|
+
|
4
|
+
require 'aruba/process'
|
4
5
|
|
5
6
|
module Aruba
|
6
7
|
module Api
|
@@ -49,7 +50,7 @@ module Aruba
|
|
49
50
|
end
|
50
51
|
|
51
52
|
def check_file_presence(paths, expect_presence)
|
52
|
-
|
53
|
+
prep_for_fs_check do
|
53
54
|
paths.each do |path|
|
54
55
|
if expect_presence
|
55
56
|
File.should be_file(path)
|
@@ -62,7 +63,7 @@ module Aruba
|
|
62
63
|
|
63
64
|
def check_file_content(file, partial_content, expect_match)
|
64
65
|
regexp = regexp(partial_content)
|
65
|
-
|
66
|
+
prep_for_fs_check do
|
66
67
|
content = IO.read(file)
|
67
68
|
if expect_match
|
68
69
|
content.should =~ regexp
|
@@ -73,13 +74,11 @@ module Aruba
|
|
73
74
|
end
|
74
75
|
|
75
76
|
def check_exact_file_content(file, exact_content)
|
76
|
-
|
77
|
-
IO.read(file).should == exact_content
|
78
|
-
end
|
77
|
+
prep_for_fs_check { IO.read(file).should == exact_content }
|
79
78
|
end
|
80
79
|
|
81
80
|
def check_directory_presence(paths, expect_presence)
|
82
|
-
|
81
|
+
prep_for_fs_check do
|
83
82
|
paths.each do |path|
|
84
83
|
if expect_presence
|
85
84
|
File.should be_directory(path)
|
@@ -90,6 +89,11 @@ module Aruba
|
|
90
89
|
end
|
91
90
|
end
|
92
91
|
|
92
|
+
def prep_for_fs_check(&block)
|
93
|
+
stop_processes!
|
94
|
+
in_current_dir{ block.call }
|
95
|
+
end
|
96
|
+
|
93
97
|
def _mkdir(dir_name)
|
94
98
|
FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
|
95
99
|
end
|
@@ -102,16 +106,39 @@ module Aruba
|
|
102
106
|
Regexp === string_or_regexp ? string_or_regexp : Regexp.compile(Regexp.escape(string_or_regexp))
|
103
107
|
end
|
104
108
|
|
105
|
-
def
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
109
|
+
def output_from(cmd)
|
110
|
+
cmd = detect_ruby(cmd)
|
111
|
+
processes[cmd].output
|
112
|
+
end
|
113
|
+
|
114
|
+
def stdout_from(cmd)
|
115
|
+
cmd = detect_ruby(cmd)
|
116
|
+
processes[cmd].stdout
|
117
|
+
end
|
118
|
+
|
119
|
+
def stderr_from(cmd)
|
120
|
+
cmd = detect_ruby(cmd)
|
121
|
+
processes[cmd].stderr
|
122
|
+
end
|
123
|
+
|
124
|
+
def all_stdout
|
125
|
+
processes.values.inject("") { |out, ps| out << ps.stdout }
|
126
|
+
end
|
127
|
+
|
128
|
+
def all_stderr
|
129
|
+
processes.values.inject("") { |out, ps| out << ps.stderr }
|
130
|
+
end
|
131
|
+
|
132
|
+
def all_output
|
133
|
+
all_stdout << all_stderr
|
134
|
+
end
|
135
|
+
|
136
|
+
def assert_exact_output(exact_output)
|
137
|
+
all_output.should == exact_output
|
111
138
|
end
|
112
139
|
|
113
140
|
def assert_partial_output(partial_output)
|
114
|
-
|
141
|
+
all_output.should include(unescape(partial_output))
|
115
142
|
end
|
116
143
|
|
117
144
|
def assert_passing_with(partial_output)
|
@@ -124,6 +151,19 @@ module Aruba
|
|
124
151
|
|
125
152
|
def assert_exit_status_and_partial_output(expect_to_pass, partial_output)
|
126
153
|
assert_partial_output(partial_output)
|
154
|
+
assert_exiting_with(expect_to_pass)
|
155
|
+
end
|
156
|
+
|
157
|
+
def assert_exit_status_and_output(expect_to_pass, output, expect_exact_output)
|
158
|
+
if expect_exact_output
|
159
|
+
assert_exact_output(output)
|
160
|
+
else
|
161
|
+
assert_partial_output(output)
|
162
|
+
end
|
163
|
+
assert_exiting_with(expect_to_pass)
|
164
|
+
end
|
165
|
+
|
166
|
+
def assert_exiting_with(expect_to_pass)
|
127
167
|
if expect_to_pass
|
128
168
|
@last_exit_status.should == 0
|
129
169
|
else
|
@@ -139,42 +179,44 @@ module Aruba
|
|
139
179
|
end
|
140
180
|
end
|
141
181
|
|
142
|
-
def
|
182
|
+
def processes
|
183
|
+
@processes ||= {}
|
184
|
+
end
|
185
|
+
|
186
|
+
def stop_processes!
|
187
|
+
processes.each do |_, process|
|
188
|
+
process.stop
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def run(cmd)
|
143
193
|
cmd = detect_ruby(cmd)
|
144
194
|
|
145
195
|
in_current_dir do
|
146
196
|
announce_or_puts("$ cd #{Dir.pwd}") if @announce_dir
|
147
197
|
announce_or_puts("$ #{cmd}") if @announce_cmd
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
announce_or_puts(@last_stdout) if @announce_stdout
|
152
|
-
@last_stderr = ps.stderr.read
|
153
|
-
announce_or_puts(@last_stderr) if @announce_stderr
|
154
|
-
end
|
198
|
+
|
199
|
+
process = processes[cmd] = Process.new(cmd)
|
200
|
+
process.run!
|
155
201
|
|
156
|
-
|
157
|
-
fail("Exit status was #{@last_exit_status}. Output:\n#{combined_output}")
|
202
|
+
block_given? ? yield(process) : process
|
158
203
|
end
|
159
|
-
|
160
|
-
@last_stderr
|
161
204
|
end
|
162
205
|
|
163
|
-
def
|
164
|
-
|
206
|
+
def run_simple(cmd, fail_on_error=true)
|
207
|
+
@last_exit_status = run(cmd) do |process|
|
208
|
+
announce_or_puts(process.stdout) if @announce_stdout
|
209
|
+
announce_or_puts(process.stderr) if @announce_stderr
|
210
|
+
process.stop
|
211
|
+
end
|
165
212
|
|
166
|
-
|
167
|
-
|
213
|
+
if(@last_exit_status != 0 && fail_on_error)
|
214
|
+
fail("Exit status was #{@last_exit_status}. Output:\n#{all_output}")
|
168
215
|
end
|
169
216
|
end
|
170
217
|
|
171
|
-
def
|
172
|
-
|
173
|
-
@interactive.wait(1) || @interactive.kill('TERM')
|
174
|
-
@interactive.stdout.read
|
175
|
-
else
|
176
|
-
""
|
177
|
-
end
|
218
|
+
def run_interactive(cmd)
|
219
|
+
@interactive = run(cmd)
|
178
220
|
end
|
179
221
|
|
180
222
|
def write_interactive(input)
|
data/lib/aruba/cucumber.rb
CHANGED
@@ -92,11 +92,11 @@ When /^I cd to "([^"]*)"$/ do |dir|
|
|
92
92
|
end
|
93
93
|
|
94
94
|
When /^I run "(.*)"$/ do |cmd|
|
95
|
-
|
95
|
+
run_simple(unescape(cmd), false)
|
96
96
|
end
|
97
97
|
|
98
98
|
When /^I successfully run "(.*)"$/ do |cmd|
|
99
|
-
|
99
|
+
run_simple(unescape(cmd))
|
100
100
|
end
|
101
101
|
|
102
102
|
When /^I run "([^"]*)" interactively$/ do |cmd|
|
@@ -108,27 +108,35 @@ When /^I type "([^"]*)"$/ do |input|
|
|
108
108
|
end
|
109
109
|
|
110
110
|
Then /^the output should contain "([^"]*)"$/ do |partial_output|
|
111
|
-
assert_partial_output(partial_output)
|
111
|
+
assert_partial_output(unescape(partial_output))
|
112
|
+
end
|
113
|
+
|
114
|
+
Then /^the output from "([^"]*)" should contain "([^"]*)"$/ do |cmd, partial_output|
|
115
|
+
output_from(cmd).should include(unescape(partial_output))
|
116
|
+
end
|
117
|
+
|
118
|
+
Then /^the output from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, partial_output|
|
119
|
+
output_from(cmd).should_not include(unescape(partial_output))
|
112
120
|
end
|
113
121
|
|
114
122
|
Then /^the output should not contain "([^"]*)"$/ do |partial_output|
|
115
|
-
|
123
|
+
all_output.should_not include(unescape(partial_output))
|
116
124
|
end
|
117
125
|
|
118
126
|
Then /^the output should contain:$/ do |partial_output|
|
119
|
-
|
127
|
+
all_output.should include(unescape(partial_output))
|
120
128
|
end
|
121
129
|
|
122
130
|
Then /^the output should not contain:$/ do |partial_output|
|
123
|
-
|
131
|
+
all_output.should_not include(unescape(partial_output))
|
124
132
|
end
|
125
133
|
|
126
134
|
Then /^the output should contain exactly "([^"]*)"$/ do |exact_output|
|
127
|
-
|
135
|
+
all_output.should == unescape(exact_output)
|
128
136
|
end
|
129
137
|
|
130
138
|
Then /^the output should contain exactly:$/ do |exact_output|
|
131
|
-
|
139
|
+
all_output.should == unescape(exact_output)
|
132
140
|
end
|
133
141
|
|
134
142
|
# "the output should match" allows regex in the partial_output, if
|
@@ -136,11 +144,11 @@ end
|
|
136
144
|
# that way, you don't have to escape regex characters that
|
137
145
|
# appear naturally in the output
|
138
146
|
Then /^the output should match \/([^\/]*)\/$/ do |partial_output|
|
139
|
-
|
147
|
+
all_output.should =~ /#{partial_output}/
|
140
148
|
end
|
141
149
|
|
142
150
|
Then /^the output should match:$/ do |partial_output|
|
143
|
-
|
151
|
+
all_output.should =~ /#{partial_output}/m
|
144
152
|
end
|
145
153
|
|
146
154
|
Then /^the exit status should be (\d+)$/ do |exit_status|
|
@@ -155,6 +163,10 @@ Then /^it should (pass|fail) with:$/ do |pass_fail, partial_output|
|
|
155
163
|
self.__send__("assert_#{pass_fail}ing_with", partial_output)
|
156
164
|
end
|
157
165
|
|
166
|
+
Then /^it should (pass|fail) with exactly:$/ do |pass_fail, exact_output|
|
167
|
+
assert_exit_status_and_output(pass_fail == "pass", exact_output, true)
|
168
|
+
end
|
169
|
+
|
158
170
|
Then /^it should (pass|fail) with regexp?:$/ do |pass_fail, partial_output|
|
159
171
|
Then "the output should match:", partial_output
|
160
172
|
if pass_fail == 'pass'
|
@@ -165,19 +177,43 @@ Then /^it should (pass|fail) with regexp?:$/ do |pass_fail, partial_output|
|
|
165
177
|
end
|
166
178
|
|
167
179
|
Then /^the stderr should contain "([^"]*)"$/ do |partial_output|
|
168
|
-
|
180
|
+
all_stderr.should include(unescape(partial_output))
|
181
|
+
end
|
182
|
+
|
183
|
+
Then /^the stderr should contain exactly:$/ do |exact_output|
|
184
|
+
@last_stderr.should == exact_output
|
169
185
|
end
|
170
186
|
|
171
187
|
Then /^the stdout should contain "([^"]*)"$/ do |partial_output|
|
172
|
-
|
188
|
+
all_stdout.should include(unescape(partial_output))
|
189
|
+
end
|
190
|
+
|
191
|
+
Then /^the stdout should contain exactly:$/ do |exact_output|
|
192
|
+
@stdout.should == exact_output
|
173
193
|
end
|
174
194
|
|
175
195
|
Then /^the stderr should not contain "([^"]*)"$/ do |partial_output|
|
176
|
-
|
196
|
+
all_stderr.should_not include(unescape(partial_output))
|
177
197
|
end
|
178
198
|
|
179
199
|
Then /^the stdout should not contain "([^"]*)"$/ do |partial_output|
|
180
|
-
|
200
|
+
all_stdout.should_not include(unescape(partial_output))
|
201
|
+
end
|
202
|
+
|
203
|
+
Then /^the stdout from "([^"]*)" should contain "([^"]*)"$/ do |cmd, partial_output|
|
204
|
+
stdout_from(cmd).should include(unescape(partial_output))
|
205
|
+
end
|
206
|
+
|
207
|
+
Then /^the stdout from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, partial_output|
|
208
|
+
stdout_from(cmd).should_not include(unescape(partial_output))
|
209
|
+
end
|
210
|
+
|
211
|
+
Then /^the stderr from "([^"]*)" should contain "([^"]*)"$/ do |cmd, partial_output|
|
212
|
+
stderr_from(cmd).should include(unescape(partial_output))
|
213
|
+
end
|
214
|
+
|
215
|
+
Then /^the stderr from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, partial_output|
|
216
|
+
stderr_from(cmd).should_not include(unescape(partial_output))
|
181
217
|
end
|
182
218
|
|
183
219
|
Then /^the file "([^"]*)" should not exist$/ do |file_name|
|
@@ -192,6 +228,14 @@ Then /^the following files should not exist:$/ do |files|
|
|
192
228
|
check_file_presence(files.raw.map{|file_row| file_row[0]}, false)
|
193
229
|
end
|
194
230
|
|
231
|
+
Then /^a file named "([^"]*)" should exist$/ do |file|
|
232
|
+
check_file_presence([file], true)
|
233
|
+
end
|
234
|
+
|
235
|
+
Then /^a file named "([^"]*)" should not exist$/ do |file|
|
236
|
+
check_file_presence([file], false)
|
237
|
+
end
|
238
|
+
|
195
239
|
Then /^the following directories should exist:$/ do |directories|
|
196
240
|
check_directory_presence(directories.raw.map{|directory_row| directory_row[0]}, true)
|
197
241
|
end
|
@@ -200,6 +244,14 @@ Then /^the following directories should not exist:$/ do |directories|
|
|
200
244
|
check_directory_presence(directories.raw.map{|directory_row| directory_row[0]}, false)
|
201
245
|
end
|
202
246
|
|
247
|
+
Then /^a directory named "([^"]*)" should exist$/ do |directory|
|
248
|
+
check_directory_presence([directory], true)
|
249
|
+
end
|
250
|
+
|
251
|
+
Then /^a directory named "([^"]*)" should not exist$/ do |directory|
|
252
|
+
check_directory_presence([directory], false)
|
253
|
+
end
|
254
|
+
|
203
255
|
Then /^the file "([^"]*)" should contain "([^"]*)"$/ do |file, partial_content|
|
204
256
|
check_file_content(file, partial_content, true)
|
205
257
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'background_process'
|
2
|
+
|
3
|
+
module Aruba
|
4
|
+
class Process
|
5
|
+
def initialize(cmd)
|
6
|
+
@cmd = cmd
|
7
|
+
end
|
8
|
+
|
9
|
+
def run!(&block)
|
10
|
+
@process = BackgroundProcess.run(@cmd)
|
11
|
+
yield self if block_given?
|
12
|
+
end
|
13
|
+
|
14
|
+
def stdin
|
15
|
+
@process.stdin
|
16
|
+
end
|
17
|
+
|
18
|
+
def output
|
19
|
+
stdout + stderr
|
20
|
+
end
|
21
|
+
|
22
|
+
def stdout
|
23
|
+
if @process
|
24
|
+
@stdout ||= @process.stdout.read
|
25
|
+
else
|
26
|
+
''
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def stderr
|
31
|
+
if @process
|
32
|
+
@stderr ||= @process.stderr.read
|
33
|
+
else
|
34
|
+
''
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def stop
|
39
|
+
if @process
|
40
|
+
status = @process.wait(1)
|
41
|
+
status && status.exitstatus
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 5
|
9
|
+
version: 0.2.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Aslak Helles\xC3\xB8y"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-13 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -28,8 +28,8 @@ dependencies:
|
|
28
28
|
segments:
|
29
29
|
- 0
|
30
30
|
- 9
|
31
|
-
-
|
32
|
-
version: 0.9.
|
31
|
+
- 4
|
32
|
+
version: 0.9.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
35
|
version_requirements: *id001
|
@@ -83,8 +83,10 @@ files:
|
|
83
83
|
- Rakefile
|
84
84
|
- aruba.gemspec
|
85
85
|
- config/.gitignore
|
86
|
+
- cucumber.yml
|
86
87
|
- features/exit_statuses.feature
|
87
88
|
- features/file_system_commands.feature
|
89
|
+
- features/flushing.feature
|
88
90
|
- features/interactive.feature
|
89
91
|
- features/output.feature
|
90
92
|
- features/step_definitions/aruba_dev_steps.rb
|
@@ -92,6 +94,7 @@ files:
|
|
92
94
|
- lib/aruba.rb
|
93
95
|
- lib/aruba/api.rb
|
94
96
|
- lib/aruba/cucumber.rb
|
97
|
+
- lib/aruba/process.rb
|
95
98
|
has_rdoc: true
|
96
99
|
homepage: http://github.com/aslakhellesoy/aruba
|
97
100
|
licenses: []
|
@@ -106,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
109
|
requirements:
|
107
110
|
- - ">="
|
108
111
|
- !ruby/object:Gem::Version
|
109
|
-
hash:
|
112
|
+
hash: 1671730072629991587
|
110
113
|
segments:
|
111
114
|
- 0
|
112
115
|
version: "0"
|
@@ -115,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
118
|
requirements:
|
116
119
|
- - ">="
|
117
120
|
- !ruby/object:Gem::Version
|
118
|
-
hash:
|
121
|
+
hash: 1671730072629991587
|
119
122
|
segments:
|
120
123
|
- 0
|
121
124
|
version: "0"
|
@@ -125,10 +128,11 @@ rubyforge_project:
|
|
125
128
|
rubygems_version: 1.3.7
|
126
129
|
signing_key:
|
127
130
|
specification_version: 3
|
128
|
-
summary: aruba-0.2.
|
131
|
+
summary: aruba-0.2.5
|
129
132
|
test_files:
|
130
133
|
- features/exit_statuses.feature
|
131
134
|
- features/file_system_commands.feature
|
135
|
+
- features/flushing.feature
|
132
136
|
- features/interactive.feature
|
133
137
|
- features/output.feature
|
134
138
|
- features/step_definitions/aruba_dev_steps.rb
|