aruba-turnip 0.1.0

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.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.rspec +4 -0
  4. data/.travis.yml +5 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +10 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +55 -0
  9. data/Rakefile +6 -0
  10. data/aruba-turnip.gemspec +30 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/lib/aruba/turnip/command.rb +379 -0
  14. data/lib/aruba/turnip/file.rb +223 -0
  15. data/lib/aruba/turnip/placeholders.rb +37 -0
  16. data/lib/aruba/turnip/testing_frameworks.rb +33 -0
  17. data/lib/aruba/turnip/version.rb +5 -0
  18. data/lib/aruba/turnip.rb +13 -0
  19. data/spec/acceptance/fixtures/cli-app/.rspec +4 -0
  20. data/spec/acceptance/fixtures/cli-app/README.md +39 -0
  21. data/spec/acceptance/fixtures/cli-app/Rakefile +1 -0
  22. data/spec/acceptance/fixtures/cli-app/bin/.gitkeep +0 -0
  23. data/spec/acceptance/fixtures/cli-app/cli-app.gemspec +26 -0
  24. data/spec/acceptance/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +15 -0
  25. data/spec/acceptance/fixtures/cli-app/lib/cli/app/version.rb +5 -0
  26. data/spec/acceptance/fixtures/cli-app/lib/cli/app.rb +9 -0
  27. data/spec/acceptance/fixtures/cli-app/spec/acceptance/non-existence.feature +10 -0
  28. data/spec/acceptance/fixtures/cli-app/spec/acceptance/support/env.rb +0 -0
  29. data/spec/acceptance/fixtures/cli-app/spec/spec_helper.rb +17 -0
  30. data/spec/acceptance/fixtures/cli-app/spec/support/aruba.rb +1 -0
  31. data/spec/acceptance/fixtures/cli-app/tmp/aruba/foo/bar/example.txt +1 -0
  32. data/spec/acceptance/steps/aruba_dev_steps.rb +56 -0
  33. data/spec/acceptance/testing_frameworks/turnip/steps/command/exit_statuses.feature +136 -0
  34. data/spec/acceptance/testing_frameworks/turnip/steps/command/run.feature +68 -0
  35. data/spec/acceptance/testing_frameworks/turnip/steps/filesystem/cd_to_directory.feature +33 -0
  36. data/spec/acceptance/testing_frameworks/turnip/steps/filesystem/create_directory.feature +57 -0
  37. data/spec/aruba/turnip_spec.rb +7 -0
  38. data/spec/spec_helper.rb +2 -0
  39. data/spec/turnip_helper.rb +11 -0
  40. metadata +154 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c68318e3bab555e2bcc2cec056fc44575b040dd4
4
+ data.tar.gz: 8503e02f1933c0fb1bba89d15b7db47e5bd3d667
5
+ SHA512:
6
+ metadata.gz: d0cd2b254ac61b6d33ace3c1be0589d44e41e7a3f04de6a0cd0e76d2a8c1eb18e8e9d3002de098f6ca4f158bfc75b42913ce3e78d82d6c036fb2cfd7c78b07aa
7
+ data.tar.gz: ff567de60934ba6bb536cedc6f7020f351affac16ed5263b0ec0fd8a9992fc7ff4bccd737bc24814a74658437124a36d402b9942da5c72154de0ccbac3669ff7
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ /.bundle/
2
+ /Gemfile.lock
3
+ /coverage/
4
+ /doc/
5
+ /pkg/
6
+ /spec/reports/
7
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --require spec_helper
2
+ --require turnip/rspec
3
+ --format documentation
4
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.13.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at joe.g.yates@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ group :debug do
6
+ if !RUBY_PLATFORM.include?("java")
7
+ gem "byebug", "~> 4.0.5"
8
+ gem "pry-byebug", "~> 3.1.0"
9
+ end
10
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Joe Yates
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Aruba::Turnip
2
+
3
+ This gem provides step definitions suitable for use
4
+ in projects tested with [RSpec](https://github.com/rspec/rspec) and
5
+ [Turnip](https://github.com/jnicklas/turnip).
6
+
7
+ The steps are direct adaptations of the step definitions and support code
8
+ provided by [Aruba](https://github.com/cucumber/aruba) for
9
+ [Cucumber](https://github.com/cucumber/cucumber-ruby).
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'aruba-turnip'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install aruba-turnip
26
+
27
+ ## Usage
28
+
29
+ See the step definitions in `lib/aruba/turnip`.
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies.
34
+ Then, run `rake spec` to run the tests.
35
+ You can also run `bin/console` for an interactive prompt that will allow you
36
+ to experiment.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`.
39
+ To release a new version, update the version number in `version.rb`,
40
+ and then run `bundle exec rake release`,
41
+ which will create a git tag for the version, push git commits and tags,
42
+ and push the `.gem` file to [rubygems.org](https://rubygems.org).
43
+
44
+ ## Contributing
45
+
46
+ Bug reports and pull requests are welcome on GitHub at
47
+ https://github.com/joeyates/aruba-turnip.
48
+ This project is intended to be a safe, welcoming space for collaboration,
49
+ and contributors are expected to adhere to the
50
+ [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
+
52
+ ## License
53
+
54
+ The gem is available as open source under the terms of the
55
+ [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "aruba/turnip/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "aruba-turnip"
8
+ spec.version = Aruba::Turnip::VERSION
9
+ spec.authors = ["Joe Yates"]
10
+ spec.email = ["joe.g.yates@gmail.com"]
11
+
12
+ spec.summary = %q{Turnip step definitions for Aruba.}
13
+ spec.description = <<-EOT
14
+ This gem contains adaptations of Aruba's step definitions suitable for use
15
+ in projects tested with RSpec and Turnip.
16
+ EOT
17
+ spec.homepage = "https://github.com/joeyates/aruba-turnip"
18
+ spec.license = "MIT"
19
+
20
+ spec.files = `git ls-files -z`.split("\x0")
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_development_dependency "aruba", "~> 0.14"
26
+ spec.add_development_dependency "bundler", "~> 1.13"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3"
29
+ spec.add_development_dependency "turnip"
30
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "aruba/turnip"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,379 @@
1
+ require 'aruba/generators/script_file'
2
+
3
+ step 'I run :command' do |cmd|
4
+ cmd = sanitize_text(cmd)
5
+ run_simple(cmd, fail_on_error: false)
6
+ end
7
+
8
+ ## I successfully run `echo -n "Hello"`
9
+ ## I successfully run `sleep 29` for up to 30 seconds
10
+ step 'I successfully run :command:with_optional_timeout' do |cmd, secs|
11
+ cmd = sanitize_text(cmd)
12
+ run_simple(cmd, fail_on_error: true, exit_timeout: secs)
13
+ end
14
+
15
+ =begin
16
+
17
+ step 'I run the following (?:commands|script)(?: (?:with|in) `([^`]+)`)?:' do |shell, commands|
18
+ prepend_environment_variable('PATH', expand_path('bin') + ':')
19
+
20
+ Aruba.platform.mkdir(expand_path('bin'))
21
+ shell ||= Aruba.platform.default_shell
22
+
23
+ Aruba::ScriptFile.new(:interpreter => shell, :content => commands,
24
+ :path => expand_path('bin/myscript')).call
25
+ step 'I run `myscript`'
26
+ end
27
+
28
+ =end
29
+
30
+ step 'I run :command interactively' do |cmd|
31
+ cmd = sanitize_text(cmd)
32
+ @interactive = run(cmd)
33
+ end
34
+
35
+ =begin
36
+
37
+ # Merge interactive and background after refactoring with event queue
38
+ step 'I run `([^`]*)` in background'do |cmd|
39
+ run(sanitize_text(cmd))
40
+ end
41
+
42
+ step 'I type "([^"]*)"' do |input|
43
+ type(unescape_text(input))
44
+ end
45
+
46
+ step 'I close the stdin stream' do
47
+ close_input
48
+ end
49
+
50
+ step 'I pipe in (?:a|the) file(?: named)? "([^"]*)"' do |file|
51
+ pipe_in_file(file)
52
+
53
+ close_input
54
+ end
55
+
56
+ step 'I (terminate|stop) the command (?:"([^"]*)"|(?:started last))' do |signal, command|
57
+ if command
58
+ cmd = all_commands.find { |c| c.commandline == command }
59
+ fail ArgumentError, %(No command "#{command}" found) if cmd.nil?
60
+
61
+ if signal == 'terminate'
62
+ # last_command_started.terminate
63
+ process_monitor.terminate_process!(process_monitor.get_process(command))
64
+ else
65
+ # last_command_started.stop
66
+ process_monitor.stop_process(process_monitor.get_process(command))
67
+ end
68
+ else
69
+ if signal == 'terminate'
70
+ # last_command_started.terminate
71
+ process_monitor.terminate_process!(last_command_started)
72
+ else
73
+ # last_command_started.stop
74
+ process_monitor.stop_process(last_command_started)
75
+ end
76
+ end
77
+ end
78
+
79
+ =end
80
+
81
+ step 'I stop the command (started last) if :channel contains:' do |channel, expected|
82
+ begin
83
+ Timeout.timeout(aruba.config.exit_timeout) do
84
+ loop do
85
+ output = last_command_started.public_send channel.to_sym, :wait_for_io => 0
86
+
87
+ output = sanitize_text(output)
88
+ expected = sanitize_text(expected)
89
+
90
+ if output.include? expected
91
+ last_command_started.terminate
92
+
93
+ break
94
+ end
95
+
96
+ sleep 0.1
97
+ end
98
+ end
99
+ rescue ChildProcess::TimeoutError, TimeoutError
100
+ last_command_started.terminate
101
+ end
102
+ end
103
+
104
+ =begin
105
+
106
+ step 'I wait for (?:output|stdout) to contain:' do |expected|
107
+ Timeout.timeout(aruba.config.exit_timeout) do
108
+ loop do
109
+ begin
110
+ expect(last_command_started).to have_output an_output_string_including(expected)
111
+ rescue ExpectationError
112
+ sleep 0.1
113
+ retry
114
+ end
115
+
116
+ break
117
+ end
118
+ end
119
+ end
120
+
121
+ step 'I wait for (?:output|stdout) to contain "([^"]*)"' do |expected|
122
+ Timeout.timeout(aruba.config.exit_timeout) do
123
+ loop do
124
+ begin
125
+ expect(last_command_started).to have_output an_output_string_including(expected)
126
+ rescue ExpectationError
127
+ sleep 0.1
128
+ retry
129
+ end
130
+
131
+ break
132
+ end
133
+ end
134
+ end
135
+
136
+ step 'the output should be (\d+) bytes long' do |size|
137
+ expect(all_output).to have_output_size size.to_i
138
+ end
139
+
140
+ =end
141
+
142
+ step '(the) :channel :outcome contain ":expected"' do |channel, outcome, expected|
143
+ exactly = false # TODO
144
+ cmd = false # TODO
145
+ matcher = case channel.to_sym
146
+ when :output
147
+ :have_output
148
+ when :stderr
149
+ :have_output_on_stderr
150
+ when :stdout
151
+ :have_output_on_stdout
152
+ end
153
+
154
+ commands = if cmd
155
+ [aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))]
156
+ else
157
+ all_commands
158
+ end
159
+
160
+ output_string_matcher = if exactly
161
+ :an_output_string_being_eq
162
+ else
163
+ :an_output_string_including
164
+ end
165
+
166
+ if !outcome
167
+ expect(commands).not_to include_an_object send(matcher, send(output_string_matcher, expected))
168
+ else
169
+ expect(commands).to include_an_object send(matcher, send(output_string_matcher, expected))
170
+ end
171
+ end
172
+
173
+ ## the stderr should contain "hello"
174
+ ## the stderr from "echo -n 'Hello'" should contain "hello"
175
+ ## the stderr should contain exactly:
176
+ ## the stderr from "echo -n 'Hello'" should contain exactly:
177
+ step '(the) :channel :outcome contain:' do |channel, outcome, expected|
178
+ exactly = false # TODO
179
+ cmd = false # TODO
180
+ matcher = case channel.to_sym
181
+ when :output
182
+ :have_output
183
+ when :stderr
184
+ :have_output_on_stderr
185
+ when :stdout
186
+ :have_output_on_stdout
187
+ else
188
+ fail ArgumentError, %(Invalid channel "#{channel}" chosen. Only "output", "stderr" or "stdout" are allowed.)
189
+ end
190
+
191
+ commands = if cmd
192
+ [aruba.command_monitor.find(Aruba.platform.detect_ruby(cmd))]
193
+ else
194
+ all_commands
195
+ end
196
+
197
+ output_string_matcher = if exactly
198
+ :an_output_string_being_eq
199
+ else
200
+ :an_output_string_including
201
+ end
202
+
203
+ if !outcome
204
+ expect(commands).not_to include_an_object send(matcher, send(output_string_matcher, expected))
205
+ else
206
+ expect(commands).to include_an_object send(matcher, send(output_string_matcher, expected))
207
+ end
208
+ end
209
+
210
+ =begin
211
+
212
+ # "the output should match" allows regex in the partial_output, if
213
+ # you don't need regex, use "the output should contain" instead since
214
+ # that way, you don't have to escape regex characters that
215
+ # appear naturally in the output
216
+ step 'the output should( not)? match \/([^\/]*)\/' do |negated, expected|
217
+ if negated
218
+ expect(all_commands).not_to include_an_object have_output an_output_string_matching(expected)
219
+ else
220
+ expect(all_commands).to include_an_object have_output an_output_string_matching(expected)
221
+ end
222
+ end
223
+
224
+ step 'the output should( not)? match %r<([^>]*)>' do |negated, expected|
225
+ if negated
226
+ expect(all_commands).not_to include_an_object have_output an_output_string_matching(expected)
227
+ else
228
+ expect(all_commands).to include_an_object have_output an_output_string_matching(expected)
229
+ end
230
+ end
231
+
232
+ =end
233
+
234
+ step 'the output :outcome match:' do |expect_success, expected|
235
+ if expect_success
236
+ expect(all_commands).to include_an_object have_output an_output_string_matching(expected)
237
+ else
238
+ expect(all_commands).not_to include_an_object have_output an_output_string_matching(expected)
239
+ end
240
+ end
241
+
242
+ step 'the exit status :outcome be :exit_status' do |expect_success, exit_status|
243
+ if expect_success
244
+ expect(last_command_stopped).to have_exit_status exit_status.to_i
245
+ else
246
+ expect(last_command_stopped).not_to have_exit_status exit_status.to_i
247
+ end
248
+ end
249
+
250
+ =begin
251
+
252
+ step 'it should( not)? (pass|fail) with "(.*?)"' do |negated, pass_fail, expected|
253
+ if pass_fail == 'pass'
254
+ expect(last_command_stopped).to be_successfully_executed
255
+ else
256
+ expect(last_command_stopped).not_to be_successfully_executed
257
+ end
258
+
259
+ if negated
260
+ expect(last_command_stopped).not_to have_output an_output_string_including(expected)
261
+ else
262
+ expect(last_command_stopped).to have_output an_output_string_including(expected)
263
+ end
264
+ end
265
+
266
+ step 'it should( not)? (pass|fail) with:' do |negated, pass_fail, expected|
267
+ if pass_fail == 'pass'
268
+ expect(last_command_stopped).to be_successfully_executed
269
+ else
270
+ expect(last_command_stopped).not_to be_successfully_executed
271
+ end
272
+
273
+ if negated
274
+ expect(last_command_stopped).not_to have_output an_output_string_including(expected)
275
+ else
276
+ expect(last_command_stopped).to have_output an_output_string_including(expected)
277
+ end
278
+ end
279
+
280
+ step 'it should( not)? (pass|fail) with exactly:' do |negated, pass_fail, expected|
281
+ if pass_fail == 'pass'
282
+ expect(last_command_stopped).to be_successfully_executed
283
+ else
284
+ expect(last_command_stopped).not_to be_successfully_executed
285
+ end
286
+
287
+ if negated
288
+ expect(last_command_stopped).not_to have_output an_output_string_eq(expected)
289
+ else
290
+ expect(last_command_stopped).to have_output an_output_string_being_eq(expected)
291
+ end
292
+ end
293
+
294
+ step 'it should( not)? (pass|fail) (?:with regexp?|matching):' do |negated, pass_fail, expected|
295
+ if pass_fail == 'pass'
296
+ expect(last_command_stopped).to be_successfully_executed
297
+ else
298
+ expect(last_command_stopped).not_to be_successfully_executed
299
+ end
300
+
301
+ if negated
302
+ expect(last_command_stopped).not_to have_output an_output_string_matching(expected)
303
+ else
304
+ expect(last_command_stopped).to have_output an_output_string_matching(expected)
305
+ end
306
+ end
307
+
308
+ step '(?:the )?(output|stderr|stdout) should not contain anything' do |channel|
309
+ matcher = case channel.to_sym
310
+ when :output
311
+ :have_output
312
+ when :stderr
313
+ :have_output_on_stderr
314
+ when :stdout
315
+ :have_output_on_stdout
316
+ else
317
+ fail ArgumentError, %(Invalid channel "#{channel}" chosen. Only "output", "stdout" and "stderr" are supported.)
318
+ end
319
+
320
+ expect(all_commands).to include_an_object send(matcher, be_nil.or(be_empty))
321
+ end
322
+
323
+ step '(?:the )?(output|stdout|stderr) should( not)? contain all of these lines:' do |channel, negated, table|
324
+ table.raw.flatten.each do |expected|
325
+ matcher = case channel.to_sym
326
+ when :output
327
+ :have_output
328
+ when :stderr
329
+ :have_output_on_stderr
330
+ when :stdout
331
+ :have_output_on_stdout
332
+ else
333
+ fail ArgumentError, %(Invalid channel "#{channel}" chosen. Only "output", "stdout" and "stderr" are supported.)
334
+ end
335
+
336
+ if negated
337
+ expect(all_commands).not_to include_an_object have_output an_output_string_including(expected)
338
+ else
339
+ expect(all_commands).to include_an_object have_output an_output_string_including(expected)
340
+ end
341
+ end
342
+ end
343
+
344
+ step '^the (?:default )?aruba io wait timeout is (\d+) seconds?' do |seconds|
345
+ aruba.config.io_wait_timeout = seconds.to_i
346
+ end
347
+
348
+ =end
349
+
350
+ step 'the (default) aruba exit timeout is :seconds seconds' do |seconds|
351
+ aruba.config.exit_timeout = seconds.to_i
352
+ end
353
+
354
+ =begin
355
+
356
+ step '^the (?:default )?aruba stop signal is "([^"]*)"' do |signal|
357
+ aruba.config.stop_signal = signal
358
+ end
359
+
360
+ step '^I wait (\d+) seconds? for (?:a|the) command to start up' do |seconds|
361
+ aruba.config.startup_wait_time = seconds.to_i
362
+ end
363
+
364
+ step 'I send the signal "([^"]*)" to the command (?:"([^"]*)"|(?:started last))' do |signal, command|
365
+ if command
366
+ cmd = all_commands.find { |c| c.commandline == command }
367
+ fail ArgumentError, %(No command "#{command}" found) if cmd.nil?
368
+
369
+ cmd.send_signal signal
370
+ else
371
+ last_command_started.send_signal signal
372
+ end
373
+ end
374
+
375
+ =end
376
+
377
+ step 'I look for executables in ":directory" within the current directory' do |directory|
378
+ prepend_environment_variable 'PATH', expand_path(directory) + ':'
379
+ end