aruba 0.14.9 → 0.14.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/.travis.yml +17 -37
  4. data/CHANGELOG.md +30 -0
  5. data/Gemfile +11 -1
  6. data/features/{getting_started/cleanup.feature → 01_getting_started_with_aruba/cleanup_working_directory.feature} +4 -5
  7. data/features/{getting_started → 01_getting_started_with_aruba}/run_commands.feature +45 -15
  8. data/features/{getting_started → 01_getting_started_with_aruba}/supported_testing_frameworks.feature +5 -21
  9. data/features/{configuration → 02_configure_aruba}/activate_announcer_on_command_failure.feature +2 -2
  10. data/features/{configuration/usage.feature → 02_configure_aruba/basics.feature} +21 -29
  11. data/features/{configuration → 02_configure_aruba}/command_runtime_environment.feature +0 -0
  12. data/features/{configuration → 02_configure_aruba}/console_history_file.feature +2 -2
  13. data/features/{configuration → 02_configure_aruba}/exit_timeout.feature +25 -17
  14. data/features/{configuration → 02_configure_aruba}/fixtures_directories.feature +2 -2
  15. data/features/{configuration → 02_configure_aruba}/fixtures_path_prefix.feature +1 -1
  16. data/features/{configuration → 02_configure_aruba}/home_directory.feature +6 -6
  17. data/features/{configuration → 02_configure_aruba}/io_timeout.feature +2 -2
  18. data/features/{configuration → 02_configure_aruba}/keep_ansi.feature +0 -0
  19. data/features/{configuration → 02_configure_aruba}/log_level.feature +2 -2
  20. data/features/{configuration → 02_configure_aruba}/physical_block_size.feature +3 -3
  21. data/features/{configuration → 02_configure_aruba}/remove_ansi_escape_sequences.feature +2 -2
  22. data/features/{configuration → 02_configure_aruba}/root_directory.feature +1 -1
  23. data/features/{configuration → 02_configure_aruba}/startup_wait_time.feature +2 -2
  24. data/features/{configuration → 02_configure_aruba}/working_directory.feature +9 -4
  25. data/features/{steps/core/announce.feature → 03_testing_frameworks/cucumber/announce_information_for_troubleshooting.feature} +20 -40
  26. data/features/{steps/environment → 03_testing_frameworks/cucumber}/disable_bunder.feature +0 -0
  27. data/features/{steps/command/exit_statuses.feature → 03_testing_frameworks/cucumber/steps/command/check_for_exit_statuses.feature} +20 -20
  28. data/features/{steps/command/output.feature → 03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature} +58 -111
  29. data/features/{steps/command/stderr.feature → 03_testing_frameworks/cucumber/steps/command/check_stderr_of_command.feature} +1 -1
  30. data/features/{steps/command/stdout.feature → 03_testing_frameworks/cucumber/steps/command/check_stdout_of_command.feature} +6 -6
  31. data/features/{steps/command/debug.feature → 03_testing_frameworks/cucumber/steps/command/debug_your_command_in_aruba.feature} +6 -6
  32. data/features/{steps/command/run.feature → 03_testing_frameworks/cucumber/steps/command/run_a_command.feature} +4 -4
  33. data/features/{steps/command/in_process.feature → 03_testing_frameworks/cucumber/steps/command/run_command_in_process.feature} +2 -2
  34. data/features/{steps/command/interactive.feature → 03_testing_frameworks/cucumber/steps/command/run_command_interactively.feature} +2 -2
  35. data/features/03_testing_frameworks/cucumber/steps/command/run_commands_which_require_a_shell.feature +79 -0
  36. data/features/{steps/command/send_signal.feature → 03_testing_frameworks/cucumber/steps/command/send_signal_to_command.feature} +19 -40
  37. data/features/{steps/command/stop.feature → 03_testing_frameworks/cucumber/steps/command/stop_command.feature} +47 -75
  38. data/features/{steps → 03_testing_frameworks/cucumber/steps}/environment/append_environment_variable.feature +3 -3
  39. data/features/{steps/environment/home_variable.feature → 03_testing_frameworks/cucumber/steps/environment/modify_home_variable_for_testing.feature} +4 -4
  40. data/features/{steps → 03_testing_frameworks/cucumber/steps}/environment/prepend_environment_variable.feature +3 -3
  41. data/features/{steps → 03_testing_frameworks/cucumber/steps}/environment/set_environment_variable.feature +3 -3
  42. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/append_to_file.feature +0 -0
  43. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/cd_to_directory.feature +0 -0
  44. data/features/{steps/filesystem/existence_of_directory.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_existence_of_directory.feature} +0 -0
  45. data/features/{steps/filesystem/existence_of_file.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_existence_of_file.feature} +0 -0
  46. data/features/{steps/filesystem/file_content.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_file_content.feature} +57 -0
  47. data/features/{steps/filesystem/non_existence_of_directory.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_non_existence_of_directory.feature} +0 -0
  48. data/features/{steps/filesystem/non_existence_of_file.feature → 03_testing_frameworks/cucumber/steps/filesystem/check_non_existence_of_file.feature} +0 -0
  49. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/check_permissions_of_file.feature +0 -0
  50. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/compare_files.feature +0 -0
  51. data/features/{steps/filesystem/copy.feature → 03_testing_frameworks/cucumber/steps/filesystem/copy_file_or_directory.feature} +0 -0
  52. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/create_directory.feature +0 -0
  53. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/create_file.feature +0 -0
  54. data/features/{steps/filesystem/move.feature → 03_testing_frameworks/cucumber/steps/filesystem/move_file_or_directory.feature} +0 -1
  55. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/overwrite_file.feature +0 -0
  56. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/remove_directory.feature +0 -0
  57. data/features/{steps → 03_testing_frameworks/cucumber/steps}/filesystem/remove_file.feature +0 -0
  58. data/features/{steps/filesystem/use_fixture.feature → 03_testing_frameworks/cucumber/steps/filesystem/use_fixtures_for_setup_test.feature} +0 -0
  59. data/features/{hooks/after/command.feature → 03_testing_frameworks/rspec/hooks/define_after_hook_for_commands.feature} +1 -4
  60. data/features/{hooks/before/command.feature → 03_testing_frameworks/rspec/hooks/define_before_hook_for_commands.feature} +1 -5
  61. data/features/{rspec/integration.feature → 03_testing_frameworks/rspec/setup_aruba_for_rspec.feature} +17 -17
  62. data/features/{api/command/find_command.feature → 04_aruba_api/command/find_a_started_command.feature} +0 -0
  63. data/features/{api/command/which.feature → 04_aruba_api/command/find_command_in_PATH.feature} +4 -4
  64. data/features/{api/command/stderr.feature → 04_aruba_api/command/read_stderr_of_command.feature} +8 -8
  65. data/features/{api/command/stdout.feature → 04_aruba_api/command/read_stdout_of_command.feature} +7 -7
  66. data/features/{api/command/run.feature → 04_aruba_api/command/run_command.feature} +53 -44
  67. data/features/{api → 04_aruba_api}/command/run_simple.feature +46 -34
  68. data/features/{api/command/send_signal.feature → 04_aruba_api/command/send_signal_to_command.feature} +8 -8
  69. data/features/{api → 04_aruba_api}/command/stop_all_commands.feature +18 -14
  70. data/features/{api/command/stop.feature → 04_aruba_api/command/stop_single_command.feature} +19 -18
  71. data/features/{api → 04_aruba_api}/command/terminate_all_commands.feature +16 -12
  72. data/features/{api/command/last_command_started.feature → 04_aruba_api/command/use_last_command_started.feature} +0 -0
  73. data/features/{api/command/last_command_stopped.feature → 04_aruba_api/command/use_last_command_stopped.feature} +2 -2
  74. data/features/{api → 04_aruba_api}/core/expand_path.feature +0 -0
  75. data/features/{api → 04_aruba_api}/environment/append_environment_variable.feature +0 -0
  76. data/features/{api → 04_aruba_api}/environment/delete_environment_variable.feature +0 -0
  77. data/features/{api → 04_aruba_api}/environment/prepend_environment_variable.feature +0 -0
  78. data/features/{api → 04_aruba_api}/environment/set_environment_variable.feature +0 -0
  79. data/features/{api/filesystem/cd.feature → 04_aruba_api/filesystem/cd_to_directory.feature} +0 -0
  80. data/features/{api/filesystem/does_exist.feature → 04_aruba_api/filesystem/check_existence_file_or_directory.feature} +0 -0
  81. data/features/{api/filesystem/is_absolute.feature → 04_aruba_api/filesystem/check_if_path_is_absolute.feature} +0 -0
  82. data/features/{api/filesystem/is_directory.feature → 04_aruba_api/filesystem/check_if_path_is_directory.feature} +0 -0
  83. data/features/{api/filesystem/is_file.feature → 04_aruba_api/filesystem/check_if_path_is_file.feature} +0 -0
  84. data/features/{api/filesystem/is_relative.feature → 04_aruba_api/filesystem/check_if_path_is_relative.feature} +0 -0
  85. data/features/{api → 04_aruba_api}/filesystem/create_directory.feature +0 -0
  86. data/features/{api/filesystem/move.feature → 04_aruba_api/filesystem/move_file_or_directory.feature} +0 -0
  87. data/features/{api/filesystem/disk_usage.feature → 04_aruba_api/filesystem/report_disk_usage.feature} +0 -0
  88. data/features/{api/filesystem/fixtures.feature → 04_aruba_api/filesystem/use_fixtures.feature} +0 -0
  89. data/features/{api → 04_aruba_api}/text/extract_text.feature +8 -8
  90. data/features/{api → 04_aruba_api}/text/replace_variables.feature +2 -2
  91. data/features/{api → 04_aruba_api}/text/sanitize_text.feature +22 -22
  92. data/features/{api → 04_aruba_api}/text/unescape_text.feature +12 -12
  93. data/features/{matchers/timeouts.feature → 05_use_rspec_matchers/command/check_timeouts.feature} +4 -4
  94. data/features/{matchers → 05_use_rspec_matchers}/directory/have_sub_directory.feature +0 -0
  95. data/features/{matchers → 05_use_rspec_matchers}/file/be_a_command_found_in_path.feature +0 -0
  96. data/features/{matchers → 05_use_rspec_matchers}/file/be_existing_executable.feature +0 -0
  97. data/features/{matchers → 05_use_rspec_matchers}/file/be_existing_file.feature +0 -0
  98. data/features/{matchers → 05_use_rspec_matchers}/file/have_file_content.feature +0 -0
  99. data/features/{matchers → 05_use_rspec_matchers}/file/have_file_size.feature +0 -0
  100. data/features/{matchers → 05_use_rspec_matchers}/path/be_an_absolute_path.feature +0 -0
  101. data/features/{matchers → 05_use_rspec_matchers}/path/be_an_existing_path.feature +0 -0
  102. data/features/{matchers → 05_use_rspec_matchers}/path/have_permissions.feature +4 -4
  103. data/features/{cli/init.feature → 06_use_aruba_cli/initialize_project_with_aruba.feature} +0 -0
  104. data/features/{cli/console.feature → 06_use_aruba_cli/open_console.feature} +0 -0
  105. data/features/08_other/improve_performance_if_using_jruby.feature +37 -0
  106. data/features/step_definitions/hooks.rb +0 -10
  107. data/features/support/env.rb +1 -1
  108. data/features/support/simplecov_setup.rb +9 -6
  109. data/fixtures/cli-app/bin/{cli → aruba-test-cli} +0 -0
  110. data/fixtures/cli-app/spec/spec_helper.rb +1 -0
  111. data/fixtures/empty-app/lib/cli/app.rb +0 -6
  112. data/lib/aruba/api/commands.rb +24 -0
  113. data/lib/aruba/api/core.rb +9 -2
  114. data/lib/aruba/api/deprecated.rb +2 -73
  115. data/lib/aruba/api/filesystem.rb +1 -1
  116. data/lib/aruba/colorizer.rb +10 -99
  117. data/lib/aruba/config/jruby.rb +15 -5
  118. data/lib/aruba/cucumber.rb +1 -0
  119. data/lib/aruba/cucumber/command.rb +63 -93
  120. data/lib/aruba/cucumber/deprecated.rb +93 -0
  121. data/lib/aruba/cucumber/file.rb +0 -12
  122. data/lib/aruba/cucumber/hooks.rb +0 -44
  123. data/lib/aruba/in_process.rb +2 -0
  124. data/lib/aruba/matchers/string/output_string_eq.rb +1 -1
  125. data/lib/aruba/platforms/announcer.rb +1 -1
  126. data/lib/aruba/platforms/command_monitor.rb +0 -3
  127. data/lib/aruba/processes/spawn_process.rb +17 -5
  128. data/lib/aruba/spawn_process.rb +4 -1
  129. data/lib/aruba/version.rb +1 -1
  130. data/script/bootstrap +0 -4
  131. data/spec/aruba/api/core_spec.rb +142 -0
  132. data/spec/aruba/api/deprecated_spec.rb +113 -0
  133. data/spec/aruba/api/filesystem_spec.rb +746 -0
  134. data/spec/aruba/api_spec.rb +1 -885
  135. data/spec/aruba/jruby_spec.rb +46 -28
  136. data/spec/aruba/{spawn_process_spec.rb → processes/spawn_process_spec.rb} +18 -2
  137. data/spec/spec_helper.rb +5 -3
  138. metadata +108 -115
  139. data/features/development/build.feature +0 -15
  140. data/features/getting_started/writing_good_feature_tests.feature +0 -38
  141. data/features/matchers/collection/include_an_object.feature +0 -72
  142. data/features/platforms/jruby.feature +0 -14
  143. data/features/step_definitions/aruba_dev_steps.rb +0 -56
  144. data/features/steps/command/shell.feature +0 -155
  145. data/features/steps/filesystem/check_file_content.feature +0 -61
  146. data/features/steps/filesystem/fixtures.feature +0 -64
  147. data/features/steps/overview.feature +0 -25
  148. data/spec/aruba/api/environment/restore_env_spec.rb +0 -86
  149. data/spec/aruba/api/environment/set_env_spec.rb +0 -46
  150. data/spec/aruba/api/filesystem/file_size_spec.rb +0 -28
@@ -1,4 +1,4 @@
1
- Feature: Run command
1
+ Feature: Run command in a simpler fashion
2
2
 
3
3
  To run a command use the `#run_command_and_stop`-method. There are some configuration options
4
4
  which are relevant here:
@@ -13,7 +13,7 @@ Feature: Run command
13
13
  Given I use a fixture named "cli-app"
14
14
 
15
15
  Scenario: Require executable to succeed (by default value)
16
- Given an executable named "bin/cli" with:
16
+ Given an executable named "bin/aruba-test-cli" with:
17
17
  """bash
18
18
  #!/bin/bash
19
19
  exit 1
@@ -23,14 +23,14 @@ Feature: Run command
23
23
  require 'spec_helper'
24
24
 
25
25
  RSpec.describe 'Run command', :type => :aruba do
26
- it { expect { run_command_and_stop('cli') }.to raise_error RSpec::Expectations::ExpectationNotMetError }
26
+ it { expect { run_command_and_stop('aruba-test-cli') }.to raise_error RSpec::Expectations::ExpectationNotMetError }
27
27
  end
28
28
  """
29
29
  When I run `rspec`
30
30
  Then the specs should all pass
31
31
 
32
32
  Scenario: Require executable to succeed (set by option)
33
- Given an executable named "bin/cli" with:
33
+ Given an executable named "bin/aruba-test-cli" with:
34
34
  """bash
35
35
  #!/bin/bash
36
36
  exit 1
@@ -40,14 +40,14 @@ Feature: Run command
40
40
  require 'spec_helper'
41
41
 
42
42
  RSpec.describe 'Run command', :type => :aruba do
43
- it { expect { run_command_and_stop('cli', :fail_on_error => true) }.to raise_error }
43
+ it { expect { run_command_and_stop('aruba-test-cli', :fail_on_error => true) }.to raise_error }
44
44
  end
45
45
  """
46
46
  When I run `rspec`
47
47
  Then the specs should all pass
48
48
 
49
49
  Scenario: Require executable to succeed (set by option, deprecated)
50
- Given an executable named "bin/cli" with:
50
+ Given an executable named "bin/aruba-test-cli" with:
51
51
  """bash
52
52
  #!/bin/bash
53
53
  exit 1
@@ -57,14 +57,14 @@ Feature: Run command
57
57
  require 'spec_helper'
58
58
 
59
59
  RSpec.describe 'Run command', :type => :aruba do
60
- it { expect { run_command_and_stop('cli', true) }.to raise_error }
60
+ it { expect { run_command_and_stop('aruba-test-cli', true) }.to raise_error }
61
61
  end
62
62
  """
63
63
  When I run `rspec`
64
64
  Then the specs should all pass
65
65
 
66
66
  Scenario: Ignore failure of executable (set by option)
67
- Given an executable named "bin/cli" with:
67
+ Given an executable named "bin/aruba-test-cli" with:
68
68
  """bash
69
69
  #!/bin/bash
70
70
  exit 1
@@ -74,14 +74,14 @@ Feature: Run command
74
74
  require 'spec_helper'
75
75
 
76
76
  RSpec.describe 'Run command', :type => :aruba do
77
- it { expect { run_command_and_stop('cli', :fail_on_error => false) }.not_to raise_error }
77
+ it { expect { run_command_and_stop('aruba-test-cli', :fail_on_error => false) }.not_to raise_error }
78
78
  end
79
79
  """
80
80
  When I run `rspec`
81
81
  Then the specs should all pass
82
82
 
83
83
  Scenario: Ignore failure of executable (set by option, deprecated)
84
- Given an executable named "bin/cli" with:
84
+ Given an executable named "bin/aruba-test-cli" with:
85
85
  """bash
86
86
  #!/bin/bash
87
87
  exit 1
@@ -91,7 +91,7 @@ Feature: Run command
91
91
  require 'spec_helper'
92
92
 
93
93
  RSpec.describe 'Run command', :type => :aruba do
94
- it { expect { run_command_and_stop('cli', false) }.not_to raise_error }
94
+ it { expect { run_command_and_stop('aruba-test-cli', false) }.not_to raise_error }
95
95
  end
96
96
  """
97
97
  When I run `rspec`
@@ -102,14 +102,14 @@ Feature: Run command
102
102
  If you have got a command with a long startup phase or use `ruby` together
103
103
  with `bundler`, you should consider using the `startup_wait_time`-option.
104
104
  Otherwise methods like `#send_signal` don't work since they require the
105
- command to be running and have setup it's signal handler.
105
+ command to be running and have setup its signal handler.
106
106
 
107
- Given an executable named "bin/cli" with:
107
+ Given an executable named "bin/aruba-test-cli" with:
108
108
  """bash
109
109
  #!/usr/bin/env bash
110
110
 
111
111
  function initialize_script {
112
- sleep 2
112
+ sleep 0.2
113
113
  }
114
114
 
115
115
  function do_some_work {
@@ -125,27 +125,31 @@ Feature: Run command
125
125
  """ruby
126
126
  require 'spec_helper'
127
127
 
128
- RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 2 do
129
- before(:each) { run_command_and_stop('cli') }
128
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 0.1, :startup_wait_time => 0.3 do
129
+ before(:each) { run_command_and_stop('aruba-test-cli') }
130
130
 
131
- it { expect(last_command_started).to be_successfully_executed }
132
- it { expect(last_command_started).to have_output /Hello, Aruba is working/ }
131
+ it 'runs the command with the expected results' do
132
+ aggregate_failures do
133
+ expect(last_command_started).to be_successfully_executed
134
+ expect(last_command_started).to have_output /Hello, Aruba is working/
135
+ end
136
+ end
133
137
  end
134
138
  """
135
139
  When I run `rspec`
136
140
  Then the specs should all pass
137
141
 
138
- Scenario: Long running command
142
+ Scenario: Long-running command
139
143
 
140
- If you have got a "long running" command, you should consider using the
144
+ If you have got a long-running command, you should consider using the
141
145
  `exit_timeout`-option.
142
146
 
143
- Given an executable named "bin/cli" with:
147
+ Given an executable named "bin/aruba-test-cli" with:
144
148
  """bash
145
149
  #!/usr/bin/env bash
146
150
 
147
151
  function do_some_work {
148
- sleep 2
152
+ sleep 0.2
149
153
  echo "Hello, Aruba here"
150
154
  }
151
155
 
@@ -155,11 +159,15 @@ Feature: Run command
155
159
  """ruby
156
160
  require 'spec_helper'
157
161
 
158
- RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3 do
159
- before(:each) { run_command_and_stop('cli') }
162
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 0.3 do
163
+ before(:each) { run_command_and_stop('aruba-test-cli') }
160
164
 
161
- it { expect(last_command_started).to be_successfully_executed }
162
- it { expect(last_command_started).to have_output /Hello, Aruba here/ }
165
+ it 'runs the command with the expected results' do
166
+ aggregate_failures do
167
+ expect(last_command_started).to be_successfully_executed
168
+ expect(last_command_started).to have_output /Hello, Aruba here/
169
+ end
170
+ end
163
171
  end
164
172
  """
165
173
  When I run `rspec`
@@ -171,16 +179,16 @@ Feature: Run command
171
179
  `#run_command_and_stop()` does not make sense. The command is stopped internally when
172
180
  its exit status is checked.
173
181
 
174
- Given an executable named "bin/cli" with:
182
+ Given an executable named "bin/aruba-test-cli" with:
175
183
  """bash
176
184
  #!/usr/bin/env bash
177
185
 
178
186
  function initialize_script {
179
- sleep 1
187
+ sleep 0.1
180
188
  }
181
189
 
182
190
  function cleanup_script {
183
- sleep 1
191
+ sleep 0.1
184
192
  }
185
193
 
186
194
  function do_some_work {
@@ -198,9 +206,13 @@ Feature: Run command
198
206
  """ruby
199
207
  require 'spec_helper'
200
208
 
201
- RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2, :startup_wait_time => 1 do
202
- before(:each) { run_command_and_stop('cli') }
203
- it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError }
209
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 0.2, :startup_wait_time => 0.2 do
210
+ before { run_command_and_stop('aruba-test-cli') }
211
+
212
+ it 'refuses to send a signal' do
213
+ expect { last_command_started.send_signal 'HUP' }.
214
+ to raise_error Aruba::CommandAlreadyStoppedError
215
+ end
204
216
  end
205
217
  """
206
218
  When I run `rspec`
@@ -208,7 +220,7 @@ Feature: Run command
208
220
 
209
221
  Scenario: Activate announcer channels on failure
210
222
 
211
- Given an executable named "bin/cli" with:
223
+ Given an executable named "bin/aruba-test-cli" with:
212
224
  """bash
213
225
  #!/bin/bash
214
226
  echo "Hello, I'm STDOUT"
@@ -224,7 +236,7 @@ Feature: Run command
224
236
  end
225
237
 
226
238
  RSpec.describe 'Run command', :type => :aruba do
227
- it { expect { run_command_and_stop('cli', :fail_on_error => true) }.to_not raise_error }
239
+ it { expect { run_command_and_stop('aruba-test-cli', :fail_on_error => true) }.to_not raise_error }
228
240
  end
229
241
  """
230
242
  When I run `rspec`
@@ -8,7 +8,7 @@ Feature: Send running command a signal
8
8
  Given I use a fixture named "cli-app"
9
9
 
10
10
  Scenario: Existing executable
11
- Given an executable named "bin/cli" with:
11
+ Given an executable named "bin/aruba-test-cli" with:
12
12
  """ruby
13
13
  #!/usr/bin/env bash
14
14
 
@@ -19,14 +19,14 @@ Feature: Send running command a signal
19
19
 
20
20
  trap hup HUP
21
21
 
22
- while [ true ]; do sleep 1; done
22
+ while [ true ]; do sleep 0.1; done
23
23
  """
24
24
  And a file named "spec/run_spec.rb" with:
25
25
  """ruby
26
26
  require 'spec_helper'
27
27
 
28
- RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 5 do
29
- before(:each) { run_command('cli') }
28
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 0.1 do
29
+ before(:each) { run_command('aruba-test-cli') }
30
30
  before(:each) { last_command_started.send_signal 'HUP' }
31
31
  it { expect(last_command_started).to have_output /Exit/ }
32
32
  end
@@ -35,7 +35,7 @@ Feature: Send running command a signal
35
35
  Then the specs should all pass
36
36
 
37
37
  Scenario: Dying command
38
- Given an executable named "bin/cli" with:
38
+ Given an executable named "bin/aruba-test-cli" with:
39
39
  """ruby
40
40
  #!/usr/bin/env bash
41
41
  exit 1
@@ -44,9 +44,9 @@ Feature: Send running command a signal
44
44
  """ruby
45
45
  require 'spec_helper'
46
46
 
47
- RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 5 do
48
- before(:each) { run_command('cli') }
49
- it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError, /Command "cli" with PID/ }
47
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 0.1 do
48
+ before(:each) { run_command('aruba-test-cli') }
49
+ it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError, /Command "aruba-test-cli" with PID/ }
50
50
  end
51
51
  """
52
52
  When I run `rspec`
@@ -6,18 +6,18 @@ Feature: Stop all commands
6
6
  Given I use a fixture named "cli-app"
7
7
 
8
8
  Scenario: Multiple commands are running
9
- Given an executable named "bin/cli" with:
9
+ Given an executable named "bin/aruba-test-cli" with:
10
10
  """bash
11
11
  #!/bin/bash
12
- sleep 3
12
+ sleep 0.2
13
13
  """
14
14
  And a file named "spec/run_spec.rb" with:
15
15
  """ruby
16
16
  require 'spec_helper'
17
17
 
18
- RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 5 do
19
- before(:each) { run_command('cli') }
20
- before(:each) { run_command('cli') }
18
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 0.3 do
19
+ before(:each) { run_command('aruba-test-cli') }
20
+ before(:each) { run_command('aruba-test-cli') }
21
21
 
22
22
  before(:each) { stop_all_commands }
23
23
 
@@ -28,25 +28,29 @@ Feature: Stop all commands
28
28
  Then the specs should all pass
29
29
 
30
30
  Scenario: Stop all commands for which the block returns true
31
- Given an executable named "bin/cli" with:
31
+ Given an executable named "bin/aruba-test-cli" with:
32
32
  """bash
33
33
  #!/bin/bash
34
- sleep 1
34
+ sleep 0.1
35
35
  """
36
36
  And a file named "spec/run_spec.rb" with:
37
37
  """ruby
38
38
  require 'spec_helper'
39
39
 
40
- RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2 do
41
- before(:each) { @cmd1 = run_command('cli') }
42
- before(:each) { @cmd2 = run_command('cli') }
40
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 0.2 do
41
+ before(:each) { @cmd1 = run_command('aruba-test-cli') }
42
+ before(:each) { @cmd2 = run_command('aruba-test-cli') }
43
43
  before(:each) { @cmd3 = run_command('sleep 1') }
44
44
 
45
- before(:each) { stop_all_commands { |c| c.commandline == 'cli' } }
45
+ before(:each) { stop_all_commands { |c| c.commandline == 'aruba-test-cli' } }
46
46
 
47
- it { expect(@cmd1).to be_stopped }
48
- it { expect(@cmd2).to be_stopped }
49
- it { expect(@cmd3).not_to be_stopped }
47
+ it 'only stops selected commands' do
48
+ aggregate_failures do
49
+ expect(@cmd1).to be_stopped
50
+ expect(@cmd2).to be_stopped
51
+ expect(@cmd3).not_to be_stopped
52
+ end
53
+ end
50
54
  end
51
55
  """
52
56
  When I run `rspec`
@@ -6,14 +6,14 @@ Feature: Stop command
6
6
  - `find_command('command').stop`
7
7
 
8
8
  But normally there's no need to stop a command manually. All matchers
9
- handling commands make sure, that they stop ALL command before check actual
9
+ handling commands make sure, that they stop ALL commands before checking actual
10
10
  against expected.
11
11
 
12
12
  Background:
13
13
  Given I use a fixture named "cli-app"
14
14
 
15
15
  Scenario: Stop command started last
16
- Given an executable named "bin/cli" with:
16
+ Given an executable named "bin/aruba-test-cli" with:
17
17
  """bash
18
18
  #!/bin/bash
19
19
  function term {
@@ -21,14 +21,14 @@ Feature: Stop command
21
21
  }
22
22
 
23
23
  trap term TERM
24
- while [ true ]; do sleep 1; done
24
+ while [ true ]; do sleep 0.1; done
25
25
  """
26
26
  And a file named "spec/run_spec.rb" with:
27
27
  """ruby
28
28
  require 'spec_helper'
29
29
 
30
- RSpec.describe 'Run command', :type => :aruba do
31
- before(:each) { run_command('cli') }
30
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 0.2 do
31
+ before(:each) { run_command('aruba-test-cli') }
32
32
  before(:each) { last_command_started.stop }
33
33
  it { expect(last_command_started).to be_successfully_executed }
34
34
  end
@@ -37,7 +37,7 @@ Feature: Stop command
37
37
  Then the specs should all pass
38
38
 
39
39
  Scenario: Find and stop command
40
- Given an executable named "bin/cli" with:
40
+ Given an executable named "bin/aruba-test-cli" with:
41
41
  """bash
42
42
  #!/bin/bash
43
43
  function term {
@@ -45,15 +45,16 @@ Feature: Stop command
45
45
  }
46
46
 
47
47
  trap term TERM
48
- while [ true ]; do sleep 1; done
48
+ while [ true ]; do sleep 0.1; done
49
+ exit 1
49
50
  """
50
51
  And a file named "spec/run_spec.rb" with:
51
52
  """ruby
52
53
  require 'spec_helper'
53
54
 
54
- RSpec.describe 'Run command', :type => :aruba do
55
- before(:each) { run_command('cli') }
56
- before(:each) { find_command('cli').stop }
55
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 0.2 do
56
+ before(:each) { run_command('aruba-test-cli') }
57
+ before(:each) { find_command('aruba-test-cli').stop }
57
58
  it { expect(last_command_started).to be_successfully_executed }
58
59
  end
59
60
  """
@@ -61,7 +62,7 @@ Feature: Stop command
61
62
  Then the specs should all pass
62
63
 
63
64
  Scenario: Stop successful command with configured signal
64
- Given an executable named "bin/cli" with:
65
+ Given an executable named "bin/aruba-test-cli" with:
65
66
  """bash
66
67
  #!/bin/bash
67
68
  function hup {
@@ -76,7 +77,7 @@ Feature: Stop command
76
77
 
77
78
  trap hup HUP
78
79
  trap term TERM
79
- while [ true ]; do sleep 1; done
80
+ while [ true ]; do sleep 0.1; done
80
81
  """
81
82
  And a file named "spec/run_spec.rb" with:
82
83
  """ruby
@@ -84,11 +85,11 @@ Feature: Stop command
84
85
 
85
86
  Aruba.configure do |config|
86
87
  config.stop_signal = 'HUP'
87
- config.exit_timeout = 1
88
+ config.exit_timeout = 0.2
88
89
  end
89
90
 
90
91
  RSpec.describe 'Run command', :type => :aruba do
91
- before(:each) { run_command('cli') }
92
+ before(:each) { run_command('aruba-test-cli') }
92
93
  it { expect(last_command_started).to be_successfully_executed }
93
94
  end
94
95
  """
@@ -96,7 +97,7 @@ Feature: Stop command
96
97
  Then the specs should all pass
97
98
 
98
99
  Scenario: Stop unsuccessful command with configured signal
99
- Given an executable named "bin/cli" with:
100
+ Given an executable named "bin/aruba-test-cli" with:
100
101
  """bash
101
102
  #!/bin/bash
102
103
  function hup {
@@ -111,7 +112,7 @@ Feature: Stop command
111
112
 
112
113
  trap hup HUP
113
114
  trap term TERM
114
- while [ true ]; do sleep 1; done
115
+ while [ true ]; do sleep 0.1; done
115
116
  """
116
117
  And a file named "spec/run_spec.rb" with:
117
118
  """ruby
@@ -119,11 +120,11 @@ Feature: Stop command
119
120
 
120
121
  Aruba.configure do |config|
121
122
  config.stop_signal = 'HUP'
122
- config.exit_timeout = 1
123
+ config.exit_timeout = 0.2
123
124
  end
124
125
 
125
126
  RSpec.describe 'Run command', :type => :aruba do
126
- before(:each) { run_command('cli') }
127
+ before(:each) { run_command('aruba-test-cli') }
127
128
  it { expect(last_command_started).to have_exit_status 2 }
128
129
  end
129
130
  """