aruba 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/aruba.gemspec +1 -1
- data/features/output.feature +25 -5
- data/lib/aruba/api.rb +19 -16
- data/lib/aruba/cucumber.rb +34 -22
- metadata +6 -6
data/History.txt
CHANGED
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.3.
|
5
|
+
s.version = '0.3.1'
|
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
@@ -39,7 +39,11 @@ Feature: Output
|
|
39
39
|
|
40
40
|
Scenario: Detect exact one-line output
|
41
41
|
When I run "ruby -e 'puts \"hello world\"'"
|
42
|
-
Then the output should contain exactly
|
42
|
+
Then the output should contain exactly:
|
43
|
+
"""
|
44
|
+
hello world
|
45
|
+
|
46
|
+
"""
|
43
47
|
|
44
48
|
Scenario: Detect exact multiline output
|
45
49
|
When I run "ruby -e 'puts "hello\nworld"'"
|
@@ -150,15 +154,31 @@ Feature: Output
|
|
150
154
|
When I run "ruby -e 'puts \"hello world!\"'"
|
151
155
|
And I run "ruby -e 'puts gets.chomp.reverse'" interactively
|
152
156
|
And I type "hello"
|
153
|
-
Then the stdout should contain
|
154
|
-
|
157
|
+
Then the stdout should contain:
|
158
|
+
"""
|
159
|
+
hello world!
|
160
|
+
olleh
|
161
|
+
"""
|
162
|
+
And the stderr should not contain:
|
163
|
+
"""
|
164
|
+
hello world!
|
165
|
+
olleh
|
166
|
+
"""
|
155
167
|
|
156
168
|
Scenario: Detect stderr from all processes
|
157
169
|
When I run "ruby -e 'STDERR.puts \"hello world!\"'"
|
158
170
|
And I run "ruby -e 'STDERR.puts gets.chomp.reverse'" interactively
|
159
171
|
And I type "hello"
|
160
|
-
Then the stderr should contain
|
161
|
-
|
172
|
+
Then the stderr should contain:
|
173
|
+
"""
|
174
|
+
hello world!
|
175
|
+
olleh
|
176
|
+
"""
|
177
|
+
And the stdout should not contain:
|
178
|
+
"""
|
179
|
+
hello world!
|
180
|
+
olleh
|
181
|
+
"""
|
162
182
|
|
163
183
|
Scenario: Detect output from named source
|
164
184
|
When I run "ruby -e 'puts :simple'"
|
data/lib/aruba/api.rb
CHANGED
@@ -22,7 +22,15 @@ module Aruba
|
|
22
22
|
@dirs ||= ['tmp/aruba']
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def write_file(file_name, file_content)
|
26
|
+
_create_file(file_name, file_content, false)
|
27
|
+
end
|
28
|
+
|
29
|
+
def overwrite_file(file_name, file_content)
|
30
|
+
_create_file(file_name, file_content, true)
|
31
|
+
end
|
32
|
+
|
33
|
+
def _create_file(file_name, file_content, check_presence)
|
26
34
|
in_current_dir do
|
27
35
|
raise "expected #{file_name} to be present" if check_presence && !File.file?(file_name)
|
28
36
|
_mkdir(File.dirname(file_name))
|
@@ -98,8 +106,7 @@ module Aruba
|
|
98
106
|
end
|
99
107
|
|
100
108
|
def unescape(string)
|
101
|
-
string.gsub('\n', "\n")
|
102
|
-
.gsub('\"', '"')
|
109
|
+
string.gsub('\n', "\n").gsub('\"', '"')
|
103
110
|
end
|
104
111
|
|
105
112
|
def regexp(string_or_regexp)
|
@@ -171,14 +178,6 @@ module Aruba
|
|
171
178
|
end
|
172
179
|
end
|
173
180
|
|
174
|
-
def install_gems(gemfile)
|
175
|
-
create_file("Gemfile", gemfile)
|
176
|
-
if ENV['GOTGEMS'].nil?
|
177
|
-
run("gem install bundler")
|
178
|
-
run("bundle --no-color install")
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
181
|
def processes
|
183
182
|
@processes ||= {}
|
184
183
|
end
|
@@ -234,10 +233,18 @@ module Aruba
|
|
234
233
|
@interactive = run(cmd)
|
235
234
|
end
|
236
235
|
|
237
|
-
def
|
236
|
+
def type(input)
|
237
|
+
_write_interactive(_ensure_newline(input))
|
238
|
+
end
|
239
|
+
|
240
|
+
def _write_interactive(input)
|
238
241
|
@interactive.stdin.write(input)
|
239
242
|
end
|
240
243
|
|
244
|
+
def _ensure_newline(str)
|
245
|
+
str.chomp << "\n"
|
246
|
+
end
|
247
|
+
|
241
248
|
def announce_or_puts(msg)
|
242
249
|
if(@puts)
|
243
250
|
puts(msg)
|
@@ -297,9 +304,5 @@ module Aruba
|
|
297
304
|
def original_env
|
298
305
|
@original_env ||= {}
|
299
306
|
end
|
300
|
-
|
301
|
-
def ensure_newline(str)
|
302
|
-
str.chomp << "\n"
|
303
|
-
end
|
304
307
|
end
|
305
308
|
end
|
data/lib/aruba/cucumber.rb
CHANGED
@@ -64,19 +64,19 @@ Given /^a directory named "([^"]*)"$/ do |dir_name|
|
|
64
64
|
end
|
65
65
|
|
66
66
|
Given /^a file named "([^"]*)" with:$/ do |file_name, file_content|
|
67
|
-
|
67
|
+
write_file(file_name, file_content)
|
68
68
|
end
|
69
69
|
|
70
70
|
Given /^an empty file named "([^"]*)"$/ do |file_name|
|
71
|
-
|
71
|
+
write_file(file_name, "")
|
72
72
|
end
|
73
73
|
|
74
74
|
When /^I write to "([^"]*)" with:$/ do |file_name, file_content|
|
75
|
-
|
75
|
+
write_file(file_name, file_content)
|
76
76
|
end
|
77
77
|
|
78
78
|
When /^I overwrite "([^"]*)" with:$/ do |file_name, file_content|
|
79
|
-
|
79
|
+
overwrite_file(file_name, file_content, true)
|
80
80
|
end
|
81
81
|
|
82
82
|
When /^I append to "([^"]*)" with:$/ do |file_name, file_content|
|
@@ -104,39 +104,39 @@ When /^I run "([^"]*)" interactively$/ do |cmd|
|
|
104
104
|
end
|
105
105
|
|
106
106
|
When /^I type "([^"]*)"$/ do |input|
|
107
|
-
|
107
|
+
type(input)
|
108
108
|
end
|
109
109
|
|
110
110
|
Then /^the output should contain "([^"]*)"$/ do |partial_output|
|
111
|
-
assert_partial_output(
|
111
|
+
assert_partial_output(partial_output)
|
112
112
|
end
|
113
113
|
|
114
114
|
Then /^the output from "([^"]*)" should contain "([^"]*)"$/ do |cmd, partial_output|
|
115
|
-
output_from(cmd).should include(
|
115
|
+
output_from(cmd).should include(partial_output)
|
116
116
|
end
|
117
117
|
|
118
118
|
Then /^the output from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, partial_output|
|
119
|
-
output_from(cmd).should_not include(
|
119
|
+
output_from(cmd).should_not include(partial_output)
|
120
120
|
end
|
121
121
|
|
122
122
|
Then /^the output should not contain "([^"]*)"$/ do |partial_output|
|
123
|
-
all_output.should_not include(
|
123
|
+
all_output.should_not include(partial_output)
|
124
124
|
end
|
125
125
|
|
126
126
|
Then /^the output should contain:$/ do |partial_output|
|
127
|
-
all_output.should include(
|
127
|
+
all_output.should include(partial_output)
|
128
128
|
end
|
129
129
|
|
130
130
|
Then /^the output should not contain:$/ do |partial_output|
|
131
|
-
all_output.should_not include(
|
131
|
+
all_output.should_not include(partial_output)
|
132
132
|
end
|
133
133
|
|
134
134
|
Then /^the output should contain exactly "([^"]*)"$/ do |exact_output|
|
135
|
-
all_output.should ==
|
135
|
+
all_output.should == exact_output
|
136
136
|
end
|
137
137
|
|
138
138
|
Then /^the output should contain exactly:$/ do |exact_output|
|
139
|
-
all_output.should ==
|
139
|
+
all_output.should == exact_output
|
140
140
|
end
|
141
141
|
|
142
142
|
# "the output should match" allows regex in the partial_output, if
|
@@ -177,7 +177,11 @@ Then /^it should (pass|fail) with regexp?:$/ do |pass_fail, partial_output|
|
|
177
177
|
end
|
178
178
|
|
179
179
|
Then /^the stderr should contain "([^"]*)"$/ do |partial_output|
|
180
|
-
all_stderr.should include(
|
180
|
+
all_stderr.should include(partial_output)
|
181
|
+
end
|
182
|
+
|
183
|
+
Then /^the stderr should contain:$/ do |partial_output|
|
184
|
+
all_stderr.should include(partial_output)
|
181
185
|
end
|
182
186
|
|
183
187
|
Then /^the stderr should contain exactly:$/ do |exact_output|
|
@@ -185,11 +189,11 @@ Then /^the stderr should contain exactly:$/ do |exact_output|
|
|
185
189
|
end
|
186
190
|
|
187
191
|
Then /^the stdout should contain "([^"]*)"$/ do |partial_output|
|
188
|
-
all_stdout.should include(
|
192
|
+
all_stdout.should include(partial_output)
|
189
193
|
end
|
190
194
|
|
191
195
|
Then /^the stdout should contain:$/ do |partial_output|
|
192
|
-
all_stdout.should include(
|
196
|
+
all_stdout.should include(partial_output)
|
193
197
|
end
|
194
198
|
|
195
199
|
Then /^the stdout should contain exactly:$/ do |exact_output|
|
@@ -197,27 +201,35 @@ Then /^the stdout should contain exactly:$/ do |exact_output|
|
|
197
201
|
end
|
198
202
|
|
199
203
|
Then /^the stderr should not contain "([^"]*)"$/ do |partial_output|
|
200
|
-
all_stderr.should_not include(
|
204
|
+
all_stderr.should_not include(partial_output)
|
205
|
+
end
|
206
|
+
|
207
|
+
Then /^the stderr should not contain:$/ do |partial_output|
|
208
|
+
all_stderr.should_not include(partial_output)
|
201
209
|
end
|
202
210
|
|
203
211
|
Then /^the stdout should not contain "([^"]*)"$/ do |partial_output|
|
204
|
-
all_stdout.should_not include(
|
212
|
+
all_stdout.should_not include(partial_output)
|
213
|
+
end
|
214
|
+
|
215
|
+
Then /^the stdout should not contain:$/ do |partial_output|
|
216
|
+
all_stdout.should_not include(partial_output)
|
205
217
|
end
|
206
218
|
|
207
219
|
Then /^the stdout from "([^"]*)" should contain "([^"]*)"$/ do |cmd, partial_output|
|
208
|
-
stdout_from(cmd).should include(
|
220
|
+
stdout_from(cmd).should include(partial_output)
|
209
221
|
end
|
210
222
|
|
211
223
|
Then /^the stdout from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, partial_output|
|
212
|
-
stdout_from(cmd).should_not include(
|
224
|
+
stdout_from(cmd).should_not include(partial_output)
|
213
225
|
end
|
214
226
|
|
215
227
|
Then /^the stderr from "([^"]*)" should contain "([^"]*)"$/ do |cmd, partial_output|
|
216
|
-
stderr_from(cmd).should include(
|
228
|
+
stderr_from(cmd).should include(partial_output)
|
217
229
|
end
|
218
230
|
|
219
231
|
Then /^the stderr from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, partial_output|
|
220
|
-
stderr_from(cmd).should_not include(
|
232
|
+
stderr_from(cmd).should_not include(partial_output)
|
221
233
|
end
|
222
234
|
|
223
235
|
Then /^the file "([^"]*)" should not exist$/ do |file_name|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
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-29 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: -2425231353977914913
|
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: -2425231353977914913
|
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.3.
|
134
|
+
summary: aruba-0.3.1
|
135
135
|
test_files:
|
136
136
|
- features/exit_statuses.feature
|
137
137
|
- features/file_system_commands.feature
|