aruba 0.9.0.pre → 0.9.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +8 -3
- data/History.md +61 -19
- data/README.md +10 -6
- data/TODO.md +6 -1
- data/cucumber.yml +10 -6
- data/features/.nav +72 -0
- data/features/announce.feature +203 -0
- data/features/api/command/extract_text.feature +10 -0
- data/features/api/command/run.feature +6 -6
- data/features/api/command/stop_all_commands.feature +53 -0
- data/features/api/command/terminate_all_commands.feature +53 -0
- data/features/api/command/unescape_text.feature +12 -0
- data/features/api/command/which.feature +3 -3
- data/features/api/core/expand_path.feature +4 -4
- data/features/api/environment/append_environment_variable.feature +18 -8
- data/features/api/environment/prepend_environment_variable.feature +18 -8
- data/features/api/environment/set_environment_variable.feature +33 -16
- data/features/api/filesystem/cd.feature +23 -13
- data/features/api/filesystem/create_directory.feature +2 -2
- data/features/api/filesystem/disk_usage.feature +7 -6
- data/features/api/filesystem/does_exist.feature +2 -2
- data/features/api/filesystem/is_absolute.feature +2 -2
- data/features/api/filesystem/is_directory.feature +2 -2
- data/features/api/filesystem/is_file.feature +2 -2
- data/features/api/filesystem/is_relative.feature +2 -2
- data/features/api/filesystem/move.feature +119 -0
- data/features/cli/console.feature +3 -3
- data/features/commands/debug_command.feature +93 -0
- data/features/commands/environment_variables.feature +64 -0
- data/features/commands/flushing.feature +74 -0
- data/features/commands/interactive.feature +90 -0
- data/features/commands/output/all_output.feature +445 -0
- data/features/commands/output/stdout.feature +66 -0
- data/features/configuration/exit_timeout.feature +5 -5
- data/features/configuration/fixtures_directories.feature +3 -3
- data/features/configuration/fixtures_path_prefix.feature +1 -1
- data/features/configuration/home_directory.feature +4 -4
- data/features/configuration/io_timeout.feature +2 -2
- data/features/configuration/keep_ansi.feature +2 -2
- data/features/configuration/log_level.feature +3 -3
- data/features/configuration/physical_block_size.feature +3 -3
- data/features/configuration/usage.feature +159 -0
- data/features/core/cleanup_aruba_directory.feature +52 -0
- data/features/development/build.feature +16 -0
- data/features/development/test.feature +24 -0
- data/features/file_system_commands.feature +12 -12
- data/features/getting_started/supported_programming_languages.feature +89 -0
- data/features/hooks/after/command.feature +1 -1
- data/features/hooks/before/command.feature +2 -2
- data/features/matchers/collection/include_an_object.feature +72 -0
- data/features/matchers/timeouts.feature +2 -2
- data/features/output.feature +60 -181
- data/features/step_definitions/aruba_dev_steps.rb +17 -10
- data/features/step_definitions/hooks.rb +11 -0
- data/features/steps/commands/exit_statuses.feature +3 -3
- data/features/steps/commands/run.feature +0 -15
- data/features/steps/filesystem/copy.feature +45 -0
- data/features/steps/filesystem/create_directory.feature +47 -0
- data/features/steps/filesystem/create_file.feature +53 -0
- data/features/steps/filesystem/file_content.feature +1 -1
- data/features/steps/filesystem/move.feature +45 -0
- data/features/steps/filesystem/overwrite_file.feature +72 -0
- data/features/steps/filesystem/use_fixture.feature +77 -0
- data/features/usage/install.feature +8 -0
- data/{features/fixtures → fixtures}/cli-app/.gitignore +0 -0
- data/{features/fixtures → fixtures}/cli-app/.rspec +0 -0
- data/{features/fixtures → fixtures}/cli-app/README.md +0 -0
- data/{features/fixtures → fixtures}/cli-app/Rakefile +0 -0
- data/{features/fixtures → fixtures}/cli-app/bin/cli +0 -0
- data/{features/fixtures → fixtures}/cli-app/cli-app.gemspec +0 -0
- data/{features/fixtures → fixtures}/cli-app/features/support/env.rb +0 -0
- data/{features/fixtures → fixtures}/cli-app/lib/cli/app.rb +0 -0
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +15 -0
- data/{features/fixtures → fixtures}/cli-app/lib/cli/app/version.rb +0 -0
- data/{features/fixtures/empty-app → fixtures/cli-app}/script/console +3 -3
- data/{features/fixtures → fixtures}/cli-app/spec/spec_helper.rb +0 -0
- data/{features/fixtures → fixtures}/cli-app/spec/support/aruba.rb +0 -0
- data/{features/fixtures → fixtures}/copy/file.txt +0 -0
- data/{features/fixtures → fixtures}/empty-app/.gitignore +0 -0
- data/{features/fixtures → fixtures}/empty-app/.rspec +0 -0
- data/{features/fixtures → fixtures}/empty-app/README.md +0 -0
- data/{features/fixtures → fixtures}/empty-app/Rakefile +0 -0
- data/{features/fixtures → fixtures}/empty-app/bin/cli +0 -0
- data/{features/fixtures → fixtures}/empty-app/cli-app.gemspec +0 -0
- data/{features/fixtures → fixtures}/empty-app/lib/cli/app.rb +0 -0
- data/{features/fixtures → fixtures}/empty-app/lib/cli/app/version.rb +0 -0
- data/{features/fixtures/cli-app → fixtures/empty-app}/script/console +3 -3
- data/{features/fixtures → fixtures}/empty-app/spec/spec_helper.rb +0 -0
- data/{features/fixtures → fixtures}/fixtures-app/test.txt +0 -0
- data/fixtures/getting-started-app/.gitignore +4 -0
- data/fixtures/getting-started-app/Gemfile +4 -0
- data/fixtures/getting-started-app/README.md +3 -0
- data/fixtures/getting-started-app/features/support/env.rb +1 -0
- data/{features/fixtures → fixtures}/spawn_process/stderr.sh +0 -0
- data/lib/aruba/announcer.rb +6 -2
- data/lib/aruba/api.rb +0 -16
- data/lib/aruba/api/command.rb +64 -266
- data/lib/aruba/api/core.rb +24 -26
- data/lib/aruba/api/deprecated.rb +370 -12
- data/lib/aruba/api/filesystem.rb +64 -15
- data/lib/aruba/aruba_path.rb +4 -0
- data/lib/aruba/config.rb +1 -1
- data/lib/aruba/cucumber.rb +5 -449
- data/lib/aruba/cucumber/command.rb +378 -0
- data/lib/aruba/cucumber/core.rb +29 -0
- data/lib/aruba/cucumber/environment.rb +30 -0
- data/lib/aruba/cucumber/file.rb +210 -0
- data/lib/aruba/cucumber/hooks.rb +11 -14
- data/lib/aruba/cucumber/rvm.rb +3 -0
- data/lib/aruba/matchers/base/base_matcher.rb +94 -0
- data/lib/aruba/matchers/collection.rb +1 -0
- data/lib/aruba/matchers/collection/all_objects.rb +2 -0
- data/lib/aruba/matchers/collection/include_an_object.rb +120 -0
- data/lib/aruba/matchers/command/be_successfully_executed.rb +3 -3
- data/lib/aruba/matchers/command/have_exit_status.rb +2 -11
- data/lib/aruba/matchers/command/have_finished_in_time.rb +5 -5
- data/lib/aruba/matchers/command/have_output.rb +46 -0
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +42 -0
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +42 -0
- data/lib/aruba/matchers/command/have_output_size.rb +28 -0
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +1 -1
- data/lib/aruba/matchers/file/be_an_existing_file.rb +1 -1
- data/lib/aruba/matchers/file/have_file_content.rb +1 -1
- data/lib/aruba/matchers/file/have_file_size.rb +2 -2
- data/lib/aruba/matchers/file/have_same_file_content.rb +1 -1
- data/lib/aruba/matchers/path/have_permissions.rb +1 -1
- data/lib/aruba/platforms/aruba_file_creator.rb +2 -3
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -3
- data/lib/aruba/platforms/determine_disk_usage.rb +23 -0
- data/lib/aruba/platforms/determine_file_size.rb +13 -0
- data/lib/aruba/platforms/disk_usage_calculator.rb +11 -0
- data/lib/aruba/platforms/local_environment.rb +15 -0
- data/lib/aruba/platforms/unix_environment_variables.rb +1 -1
- data/lib/aruba/platforms/unix_platform.rb +35 -14
- data/lib/aruba/process_monitor.rb +53 -7
- data/lib/aruba/processes/basic_process.rb +25 -5
- data/lib/aruba/processes/debug_process.rb +27 -25
- data/lib/aruba/processes/in_process.rb +7 -22
- data/lib/aruba/processes/spawn_process.rb +74 -31
- data/lib/aruba/rspec.rb +1 -6
- data/lib/aruba/version.rb +1 -1
- data/script/console +0 -1
- data/spec/aruba/api/environment/restore_env_spec.rb +65 -0
- data/spec/aruba/api/environment/set_env_spec.rb +42 -0
- data/spec/aruba/api/filesystem/file_size_spec.rb +28 -0
- data/spec/aruba/api_spec.rb +10 -7
- data/spec/aruba/matchers/command/have_output_size_spec.rb +25 -0
- data/spec/aruba/matchers/command_spec.rb +135 -4
- data/spec/aruba/spawn_process_spec.rb +1 -1
- metadata +107 -65
- data/.nav +0 -12
- data/features/debug.feature +0 -15
- data/features/fixtures/cli-app/spec/cli/app_spec.rb +0 -7
- data/features/flushing.feature +0 -26
- data/features/interactive.feature +0 -66
- data/features/no_clobber.feature +0 -25
- data/lib/aruba/disk_usage_calculator.rb +0 -7
@@ -0,0 +1,445 @@
|
|
1
|
+
Feature: All output of commands which were executed
|
2
|
+
|
3
|
+
In order to specify expected output
|
4
|
+
As a developer using Cucumber
|
5
|
+
I want to use the "the output should contain" step
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use a fixture named "cli-app"
|
9
|
+
|
10
|
+
Scenario: Detect subset of one-line output
|
11
|
+
Given an executable named "bin/cli" with:
|
12
|
+
"""bash
|
13
|
+
#!/usr/bin/env bash
|
14
|
+
|
15
|
+
echo 'hello world'
|
16
|
+
"""
|
17
|
+
And a file named "features/output.feature" with:
|
18
|
+
"""cucumber
|
19
|
+
Feature: Run command
|
20
|
+
Scenario: Run command
|
21
|
+
When I run `cli`
|
22
|
+
Then the output should contain "hello world"
|
23
|
+
"""
|
24
|
+
When I run `cucumber`
|
25
|
+
Then the features should all pass
|
26
|
+
|
27
|
+
Scenario: Detect absence of one-line output
|
28
|
+
Given an executable named "bin/cli" with:
|
29
|
+
"""bash
|
30
|
+
#!/usr/bin/env bash
|
31
|
+
|
32
|
+
echo 'hello world'
|
33
|
+
"""
|
34
|
+
And a file named "features/output.feature" with:
|
35
|
+
"""cucumber
|
36
|
+
Feature: Run command
|
37
|
+
Scenario: Run command
|
38
|
+
When I run `cli`
|
39
|
+
Then the output should not contain "good-bye"
|
40
|
+
"""
|
41
|
+
When I run `cucumber`
|
42
|
+
Then the features should all pass
|
43
|
+
|
44
|
+
Scenario: Detect subset of multiline output
|
45
|
+
Given an executable named "bin/cli" with:
|
46
|
+
"""bash
|
47
|
+
#!/usr/bin/env bash
|
48
|
+
|
49
|
+
echo -e "hello\nworld"
|
50
|
+
"""
|
51
|
+
And a file named "features/output.feature" with:
|
52
|
+
"""cucumber
|
53
|
+
Feature: Run command
|
54
|
+
Scenario: Run command
|
55
|
+
When I run `cli`
|
56
|
+
Then the output should contain:
|
57
|
+
\"\"\"
|
58
|
+
hello
|
59
|
+
\"\"\"
|
60
|
+
"""
|
61
|
+
When I run `cucumber`
|
62
|
+
Then the features should all pass
|
63
|
+
|
64
|
+
Scenario: Detect absence of subset of multiline output
|
65
|
+
Given an executable named "bin/cli" with:
|
66
|
+
"""bash
|
67
|
+
#!/usr/bin/env bash
|
68
|
+
|
69
|
+
echo -e "hello\nworld"
|
70
|
+
"""
|
71
|
+
And a file named "features/output.feature" with:
|
72
|
+
"""cucumber
|
73
|
+
Feature: Run command
|
74
|
+
Scenario: Run command
|
75
|
+
When I run `cli`
|
76
|
+
Then the output should not contain:
|
77
|
+
\"\"\"
|
78
|
+
good-bye
|
79
|
+
\"\"\"
|
80
|
+
"""
|
81
|
+
When I run `cucumber`
|
82
|
+
Then the features should all pass
|
83
|
+
|
84
|
+
@posix
|
85
|
+
Scenario: Detect exact one-line output for posix commands
|
86
|
+
Given a file named "features/output.feature" with:
|
87
|
+
"""cucumber
|
88
|
+
Feature: Run command
|
89
|
+
Scenario: Run command
|
90
|
+
When I run `printf 'hello world'`
|
91
|
+
Then the output should contain exactly:
|
92
|
+
\"\"\"
|
93
|
+
hello world
|
94
|
+
\"\"\"
|
95
|
+
"""
|
96
|
+
When I run `cucumber`
|
97
|
+
Then the features should all pass
|
98
|
+
|
99
|
+
Scenario: Detect exact one-line output for ruby commands
|
100
|
+
Given an executable named "bin/cli" with:
|
101
|
+
"""ruby
|
102
|
+
#!/usr/bin/env ruby
|
103
|
+
|
104
|
+
print "hello world"
|
105
|
+
"""
|
106
|
+
And a file named "features/output.feature" with:
|
107
|
+
"""cucumber
|
108
|
+
Feature: Run command
|
109
|
+
Scenario: Run command
|
110
|
+
When I run `cli`
|
111
|
+
Then the output should contain exactly:
|
112
|
+
\"\"\"
|
113
|
+
hello world
|
114
|
+
\"\"\"
|
115
|
+
"""
|
116
|
+
When I run `cucumber`
|
117
|
+
Then the features should all pass
|
118
|
+
|
119
|
+
Scenario: Detect exact one-line output with ANSI output
|
120
|
+
Given an executable named "bin/cli" with:
|
121
|
+
"""bash
|
122
|
+
#!/usr/bin/env bash
|
123
|
+
|
124
|
+
echo -e "\e[36mhello world\e[0m"
|
125
|
+
"""
|
126
|
+
And a file named "features/output.feature" with:
|
127
|
+
"""cucumber
|
128
|
+
Feature: Run command
|
129
|
+
@keep-ansi-escape-sequences
|
130
|
+
Scenario: Run command
|
131
|
+
When I run `cli`
|
132
|
+
Then the output should contain exactly:
|
133
|
+
\"\"\"
|
134
|
+
\e[36mhello world\e[0m
|
135
|
+
\"\"\"
|
136
|
+
"""
|
137
|
+
When I run `cucumber`
|
138
|
+
Then the features should all pass
|
139
|
+
|
140
|
+
Scenario: Detect exact one-line output with ANSI output stripped by default
|
141
|
+
Given the default aruba exit timeout is 12 seconds
|
142
|
+
Given an executable named "bin/cli" with:
|
143
|
+
"""bash
|
144
|
+
#!/usr/bin/env bash
|
145
|
+
|
146
|
+
echo -e "\e[36mhello world\e[0m"
|
147
|
+
"""
|
148
|
+
And a file named "features/output.feature" with:
|
149
|
+
"""cucumber
|
150
|
+
Feature: Run command
|
151
|
+
Scenario: Run command
|
152
|
+
When I run `cli`
|
153
|
+
Then the output should contain exactly:
|
154
|
+
\"\"\"
|
155
|
+
hello world
|
156
|
+
\"\"\"
|
157
|
+
"""
|
158
|
+
When I run `cucumber`
|
159
|
+
Then the features should all pass
|
160
|
+
|
161
|
+
Scenario: Detect exact multiline output
|
162
|
+
Given an executable named "bin/cli" with:
|
163
|
+
"""bash
|
164
|
+
#!/usr/bin/env bash
|
165
|
+
|
166
|
+
echo -ne "hello\nworld"
|
167
|
+
"""
|
168
|
+
And a file named "features/output.feature" with:
|
169
|
+
"""cucumber
|
170
|
+
Feature: Run command
|
171
|
+
Scenario: Run command
|
172
|
+
When I run `cli`
|
173
|
+
Then the output should contain exactly:
|
174
|
+
\"\"\"
|
175
|
+
hello
|
176
|
+
world
|
177
|
+
\"\"\"
|
178
|
+
"""
|
179
|
+
When I run `cucumber`
|
180
|
+
Then the features should all pass
|
181
|
+
|
182
|
+
Scenario: Detect subset of one-line output
|
183
|
+
Given an executable named "bin/cli" with:
|
184
|
+
"""bash
|
185
|
+
#!/usr/bin/env bash
|
186
|
+
|
187
|
+
echo 'hello world'
|
188
|
+
"""
|
189
|
+
And a file named "features/output.feature" with:
|
190
|
+
"""cucumber
|
191
|
+
Feature: Run command
|
192
|
+
Scenario: Run command
|
193
|
+
When I run `cli`
|
194
|
+
Then the output should contain "hello world"
|
195
|
+
"""
|
196
|
+
When I run `cucumber`
|
197
|
+
Then the features should all pass
|
198
|
+
|
199
|
+
Scenario: Detect subset of one-line output with regex
|
200
|
+
Given an executable named "bin/cli" with:
|
201
|
+
"""bash
|
202
|
+
#!/usr/bin/env bash
|
203
|
+
|
204
|
+
echo 'hello, ruby'
|
205
|
+
"""
|
206
|
+
And a file named "features/output.feature" with:
|
207
|
+
"""cucumber
|
208
|
+
Feature: Run command
|
209
|
+
Scenario: Run command
|
210
|
+
When I run `cli`
|
211
|
+
Then the output should match /^hello(, world)?/
|
212
|
+
"""
|
213
|
+
When I run `cucumber`
|
214
|
+
Then the features should all pass
|
215
|
+
|
216
|
+
Scenario: Detect subset of multiline output with regex
|
217
|
+
Given an executable named "bin/cli" with:
|
218
|
+
"""bash
|
219
|
+
#!/usr/bin/env bash
|
220
|
+
|
221
|
+
echo -e "hello\nworld\nextra line1\nextra line2\nimportant line"
|
222
|
+
"""
|
223
|
+
And a file named "features/output.feature" with:
|
224
|
+
"""cucumber
|
225
|
+
Feature: Run command
|
226
|
+
Scenario: Run command
|
227
|
+
When I run `cli`
|
228
|
+
Then the output should match:
|
229
|
+
\"\"\"
|
230
|
+
he..o
|
231
|
+
wor.d
|
232
|
+
.*
|
233
|
+
important line
|
234
|
+
\"\"\"
|
235
|
+
"""
|
236
|
+
When I run `cucumber`
|
237
|
+
Then the features should all pass
|
238
|
+
|
239
|
+
Scenario: Negative matching of one-line output with regex
|
240
|
+
Given an executable named "bin/cli" with:
|
241
|
+
"""bash
|
242
|
+
#!/usr/bin/env bash
|
243
|
+
|
244
|
+
echo "hello, ruby"
|
245
|
+
"""
|
246
|
+
And a file named "features/output.feature" with:
|
247
|
+
"""cucumber
|
248
|
+
Feature: Run command
|
249
|
+
Scenario: Run command
|
250
|
+
When I run `cli`
|
251
|
+
Then the output should not match /ruby is a better perl$/
|
252
|
+
"""
|
253
|
+
When I run `cucumber`
|
254
|
+
Then the features should all pass
|
255
|
+
|
256
|
+
Scenario: Negative matching of multiline output with regex
|
257
|
+
Given an executable named "bin/cli" with:
|
258
|
+
"""bash
|
259
|
+
#!/usr/bin/env bash
|
260
|
+
|
261
|
+
echo -e "hello\nworld\nextra line1\nextra line2\nimportant line"
|
262
|
+
"""
|
263
|
+
And a file named "features/output.feature" with:
|
264
|
+
"""cucumber
|
265
|
+
Feature: Run command
|
266
|
+
Scenario: Run command
|
267
|
+
When I run `cli`
|
268
|
+
Then the output should not match:
|
269
|
+
\"\"\"
|
270
|
+
ruby
|
271
|
+
is
|
272
|
+
a
|
273
|
+
.*
|
274
|
+
perl
|
275
|
+
\"\"\"
|
276
|
+
"""
|
277
|
+
When I run `cucumber`
|
278
|
+
Then the features should all pass
|
279
|
+
|
280
|
+
Scenario: Match passing exit status and partial output
|
281
|
+
Given an executable named "bin/cli" with:
|
282
|
+
"""bash
|
283
|
+
#!/usr/bin/env bash
|
284
|
+
|
285
|
+
echo "hello world"
|
286
|
+
exit 0
|
287
|
+
"""
|
288
|
+
And a file named "features/output.feature" with:
|
289
|
+
"""cucumber
|
290
|
+
Feature: Run command
|
291
|
+
Scenario: Run command
|
292
|
+
When I run `cli`
|
293
|
+
Then it should pass with:
|
294
|
+
\"\"\"
|
295
|
+
hello
|
296
|
+
\"\"\"
|
297
|
+
"""
|
298
|
+
When I run `cucumber`
|
299
|
+
Then the features should all pass
|
300
|
+
|
301
|
+
Scenario: Match passing exit status and exact output
|
302
|
+
Given an executable named "bin/cli" with:
|
303
|
+
"""bash
|
304
|
+
#!/usr/bin/env bash
|
305
|
+
|
306
|
+
echo -ne "hello\nworld"
|
307
|
+
exit 0
|
308
|
+
"""
|
309
|
+
And a file named "features/output.feature" with:
|
310
|
+
"""cucumber
|
311
|
+
Feature: Run command
|
312
|
+
Scenario: Run command
|
313
|
+
When I run `cli`
|
314
|
+
Then it should pass with exactly:
|
315
|
+
\"\"\"
|
316
|
+
hello
|
317
|
+
world
|
318
|
+
\"\"\"
|
319
|
+
"""
|
320
|
+
When I run `cucumber`
|
321
|
+
Then the features should all pass
|
322
|
+
|
323
|
+
Scenario: Match failing exit status and partial output
|
324
|
+
Given an executable named "bin/cli" with:
|
325
|
+
"""bash
|
326
|
+
#!/usr/bin/env bash
|
327
|
+
|
328
|
+
echo -e "hello\nworld"
|
329
|
+
exit 1
|
330
|
+
"""
|
331
|
+
And a file named "features/output.feature" with:
|
332
|
+
"""cucumber
|
333
|
+
Feature: Run command
|
334
|
+
Scenario: Run command
|
335
|
+
When I run `cli`
|
336
|
+
Then it should fail with:
|
337
|
+
\"\"\"
|
338
|
+
hello
|
339
|
+
\"\"\"
|
340
|
+
"""
|
341
|
+
When I run `cucumber`
|
342
|
+
Then the features should all pass
|
343
|
+
|
344
|
+
|
345
|
+
Scenario: Match failing exit status and exact output
|
346
|
+
Given an executable named "bin/cli" with:
|
347
|
+
"""bash
|
348
|
+
#!/usr/bin/env bash
|
349
|
+
|
350
|
+
echo -e "hello\nworld"
|
351
|
+
exit 1
|
352
|
+
"""
|
353
|
+
And a file named "features/output.feature" with:
|
354
|
+
"""cucumber
|
355
|
+
Feature: Run command
|
356
|
+
Scenario: Run command
|
357
|
+
When I run `cli`
|
358
|
+
Then it should fail with:
|
359
|
+
\"\"\"
|
360
|
+
hello
|
361
|
+
world
|
362
|
+
\"\"\"
|
363
|
+
"""
|
364
|
+
When I run `cucumber`
|
365
|
+
Then the features should all pass
|
366
|
+
|
367
|
+
Scenario: Match failing exit status and output with regex
|
368
|
+
Given an executable named "bin/cli" with:
|
369
|
+
"""bash
|
370
|
+
#!/usr/bin/env bash
|
371
|
+
|
372
|
+
echo -e "hello\nworld"
|
373
|
+
exit 1
|
374
|
+
"""
|
375
|
+
And a file named "features/output.feature" with:
|
376
|
+
"""cucumber
|
377
|
+
Feature: Run command
|
378
|
+
Scenario: Run command
|
379
|
+
When I run `cli`
|
380
|
+
Then it should fail with regex:
|
381
|
+
\"\"\"
|
382
|
+
hello\s*world
|
383
|
+
\"\"\"
|
384
|
+
"""
|
385
|
+
When I run `cucumber`
|
386
|
+
Then the features should all pass
|
387
|
+
|
388
|
+
Scenario: Detect output from all processes
|
389
|
+
Given an executable named "bin/cli1" with:
|
390
|
+
"""bash
|
391
|
+
#!/usr/bin/env bash
|
392
|
+
|
393
|
+
echo 'This is cli1'
|
394
|
+
"""
|
395
|
+
And an executable named "bin/cli2" with:
|
396
|
+
"""bash
|
397
|
+
#!/usr/bin/env bash
|
398
|
+
|
399
|
+
echo 'This is cli2'
|
400
|
+
"""
|
401
|
+
And a file named "features/output.feature" with:
|
402
|
+
"""cucumber
|
403
|
+
Feature: Run command
|
404
|
+
Scenario: Run command
|
405
|
+
When I run `cli1`
|
406
|
+
When I run `cli2`
|
407
|
+
Then the stdout should contain exactly:
|
408
|
+
\"\"\"
|
409
|
+
This is cli1
|
410
|
+
\"\"\"
|
411
|
+
And the stdout should contain exactly:
|
412
|
+
\"\"\"
|
413
|
+
This is cli2
|
414
|
+
\"\"\"
|
415
|
+
"""
|
416
|
+
When I run `cucumber`
|
417
|
+
Then the features should all pass
|
418
|
+
|
419
|
+
Scenario: Detect output from all processes (deprecated)
|
420
|
+
Given an executable named "bin/cli1" with:
|
421
|
+
"""bash
|
422
|
+
#!/usr/bin/env bash
|
423
|
+
|
424
|
+
echo 'This is cli1'
|
425
|
+
"""
|
426
|
+
And an executable named "bin/cli2" with:
|
427
|
+
"""bash
|
428
|
+
#!/usr/bin/env bash
|
429
|
+
|
430
|
+
echo 'This is cli2'
|
431
|
+
"""
|
432
|
+
And a file named "features/output.feature" with:
|
433
|
+
"""cucumber
|
434
|
+
Feature: Run command
|
435
|
+
Scenario: Run command
|
436
|
+
When I run `cli1`
|
437
|
+
When I run `cli2`
|
438
|
+
Then the stdout should contain exactly:
|
439
|
+
\"\"\"
|
440
|
+
This is cli1
|
441
|
+
This is cli2
|
442
|
+
\"\"\"
|
443
|
+
"""
|
444
|
+
When I run `cucumber`
|
445
|
+
Then the features should all pass
|
@@ -0,0 +1,66 @@
|
|
1
|
+
Feature: Stdout of commands which were executed
|
2
|
+
|
3
|
+
In order to specify expected output
|
4
|
+
As a developer using Cucumber
|
5
|
+
I want to use the "the output should contain" step
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use a fixture named "cli-app"
|
9
|
+
|
10
|
+
Scenario: Match output in stdout
|
11
|
+
Given an executable named "bin/cli" with:
|
12
|
+
"""bash
|
13
|
+
#!/usr/bin/env bash
|
14
|
+
|
15
|
+
echo -e "hello\nworld"
|
16
|
+
"""
|
17
|
+
And a file named "features/output.feature" with:
|
18
|
+
"""cucumber
|
19
|
+
Feature: Run command
|
20
|
+
Scenario: Run command
|
21
|
+
When I run `cli`
|
22
|
+
Then the stdout should contain "hello"
|
23
|
+
Then the stderr should not contain "hello"
|
24
|
+
"""
|
25
|
+
When I run `cucumber`
|
26
|
+
Then the features should all pass
|
27
|
+
|
28
|
+
Scenario: Match stdout on several lines
|
29
|
+
Given an executable named "bin/cli" with:
|
30
|
+
"""bash
|
31
|
+
#!/usr/bin/env bash
|
32
|
+
|
33
|
+
echo 'GET /'
|
34
|
+
"""
|
35
|
+
And a file named "features/output.feature" with:
|
36
|
+
"""cucumber
|
37
|
+
Feature: Run command
|
38
|
+
Scenario: Run command
|
39
|
+
When I run `cli`
|
40
|
+
Then the stdout should contain:
|
41
|
+
\"\"\"
|
42
|
+
GET /
|
43
|
+
\"\"\"
|
44
|
+
"""
|
45
|
+
When I run `cucumber`
|
46
|
+
Then the features should all pass
|
47
|
+
|
48
|
+
Scenario: Match output on several lines where stdout contains quotes
|
49
|
+
Given an executable named "bin/cli" with:
|
50
|
+
"""bash
|
51
|
+
#!/usr/bin/env bash
|
52
|
+
|
53
|
+
echo 'GET "/"'
|
54
|
+
"""
|
55
|
+
And a file named "features/output.feature" with:
|
56
|
+
"""cucumber
|
57
|
+
Feature: Run command
|
58
|
+
Scenario: Run command
|
59
|
+
When I run `cli`
|
60
|
+
Then the stdout should contain:
|
61
|
+
\"\"\"
|
62
|
+
GET "/"
|
63
|
+
\"\"\"
|
64
|
+
"""
|
65
|
+
When I run `cucumber`
|
66
|
+
Then the features should all pass
|