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
@@ -8,7 +8,7 @@ Feature: Append environment variable via "cucumber"-step
8
8
 
9
9
  Background:
10
10
  Given I use the fixture "cli-app"
11
- And an executable named "bin/cli" with:
11
+ And an executable named "bin/aruba-test-cli" with:
12
12
  """
13
13
  #!/bin/bash
14
14
 
@@ -27,7 +27,7 @@ Feature: Append environment variable via "cucumber"-step
27
27
  Given I append the values to the environment variables:
28
28
  | variable | value |
29
29
  | LONG_LONG_VARIABLE | long_value |
30
- When I run `cli`
30
+ When I run `aruba-test-cli`
31
31
  Then the output should contain:
32
32
  \"\"\"
33
33
  1long_value
@@ -42,7 +42,7 @@ Feature: Append environment variable via "cucumber"-step
42
42
  Feature: Environment Variable
43
43
  Scenario: Run command
44
44
  Given I append "long_value" to the environment variable "LONG_LONG_VARIABLE"
45
- When I run `cli`
45
+ When I run `aruba-test-cli`
46
46
  Then the output should contain:
47
47
  \"\"\"
48
48
  1long_value
@@ -11,7 +11,7 @@ Feature: Mock the HOME variable
11
11
 
12
12
  Background:
13
13
  Given I use the fixture "cli-app"
14
- And an executable named "bin/cli" with:
14
+ And an executable named "bin/aruba-test-cli" with:
15
15
  """
16
16
  #!/bin/bash
17
17
 
@@ -24,7 +24,7 @@ Feature: Mock the HOME variable
24
24
  Feature: Home Variable
25
25
  Scenario: Run command
26
26
  Given a mocked home directory
27
- When I run `cli`
27
+ When I run `aruba-test-cli`
28
28
  Then the output should match %r<HOME:.*tmp/aruba$>
29
29
  """
30
30
  When I run `cucumber`
@@ -36,7 +36,7 @@ Feature: Mock the HOME variable
36
36
  Feature: Home Variable
37
37
  @mocked-home-directory
38
38
  Scenario: Run command
39
- When I run `cli`
39
+ When I run `aruba-test-cli`
40
40
  Then the output should match %r<HOME:.*tmp/aruba$>
41
41
  """
42
42
  When I run `cucumber`
@@ -55,7 +55,7 @@ Feature: Mock the HOME variable
55
55
  """
56
56
  Feature: Home Variable
57
57
  Scenario: Run command
58
- When I run `cli`
58
+ When I run `aruba-test-cli`
59
59
  Then the output should match %r<HOME:.*tmp/aruba$>
60
60
  """
61
61
  When I run `cucumber`
@@ -8,7 +8,7 @@ Feature: Prepend environment variable via "cucumber"-step
8
8
 
9
9
  Background:
10
10
  Given I use the fixture "cli-app"
11
- And an executable named "bin/cli" with:
11
+ And an executable named "bin/aruba-test-cli" with:
12
12
  """
13
13
  #!/bin/bash
14
14
 
@@ -27,7 +27,7 @@ Feature: Prepend environment variable via "cucumber"-step
27
27
  Given I prepend the values to the environment variables:
28
28
  | variable | value |
29
29
  | LONG_LONG_VARIABLE | long_value |
30
- When I run `cli`
30
+ When I run `aruba-test-cli`
31
31
  Then the output should contain:
32
32
  \"\"\"
33
33
  long_value1
@@ -42,7 +42,7 @@ Feature: Prepend environment variable via "cucumber"-step
42
42
  Feature: Environment Variable
43
43
  Scenario: Run command
44
44
  Given I prepend "long_value" to the environment variable "LONG_LONG_VARIABLE"
45
- When I run `cli`
45
+ When I run `aruba-test-cli`
46
46
  Then the output should contain:
47
47
  \"\"\"
48
48
  long_value1
@@ -9,7 +9,7 @@ Feature: Set environment variable via "cucumber"-step
9
9
 
10
10
  Background:
11
11
  Given I use the fixture "cli-app"
12
- And an executable named "bin/cli" with:
12
+ And an executable named "bin/aruba-test-cli" with:
13
13
  """
14
14
  #!/bin/bash
15
15
 
@@ -24,7 +24,7 @@ Feature: Set environment variable via "cucumber"-step
24
24
  Given I set the environment variables to:
25
25
  | variable | value |
26
26
  | LONG_LONG_VARIABLE | long_value |
27
- When I run `cli`
27
+ When I run `aruba-test-cli`
28
28
  Then the output should contain:
29
29
  \"\"\"
30
30
  long_value
@@ -39,7 +39,7 @@ Feature: Set environment variable via "cucumber"-step
39
39
  Feature: Environment Variable
40
40
  Scenario: Run command
41
41
  Given I set the environment variable "LONG_LONG_VARIABLE" to "long_value"
42
- When I run `cli`
42
+ When I run `aruba-test-cli`
43
43
  Then the output should contain:
44
44
  \"\"\"
45
45
  long_value
@@ -3,6 +3,63 @@ Feature: Check file content
3
3
  Background:
4
4
  Given I use a fixture named "cli-app"
5
5
 
6
+ Scenario: Check file contents with plain text
7
+ Given a file named "features/non-existence.feature" with:
8
+ """
9
+ Feature: Check
10
+ Scenario: Check
11
+ Given a file named "foo" with:
12
+ \"\"\"
13
+ hello world
14
+ \"\"\"
15
+ Then the file "foo" should contain "hello world"
16
+ And the file "foo" should not contain "HELLO WORLD"
17
+ """
18
+ When I run `cucumber`
19
+ Then the features should all pass
20
+
21
+ Scenario: Check file contents with regular expression
22
+ Given a file named "features/non-existence.feature" with:
23
+ """
24
+ Feature: Check
25
+ Background:
26
+ Given a file named "foo" with:
27
+ \"\"\"
28
+ hello world
29
+ \"\"\"
30
+
31
+ Scenario: Check #1
32
+ Then the file "foo" should match /hel.o world/
33
+ And the file "foo" should not match /HELLO WORLD/
34
+
35
+ Scenario: Check #2
36
+ Then the file "foo" should match %r<hel.o world>
37
+ And the file "foo" should not match %r<HELLO WORLD>
38
+ """
39
+ When I run `cucumber`
40
+ Then the features should all pass
41
+
42
+ Scenario: Check file contents with cucumber doc string
43
+ Given a file named "features/non-existence.feature" with:
44
+ """
45
+ Feature: Existence
46
+ Scenario: Existence
47
+ Given a file named "foo" with:
48
+ \"\"\"
49
+ foo
50
+ bar
51
+ baz
52
+ foobar
53
+ \"\"\"
54
+ Then the file "foo" should contain:
55
+ \"\"\"
56
+ bar
57
+ baz
58
+ \"\"\"
59
+ """
60
+ When I run `cucumber`
61
+ Then the features should all pass
62
+
6
63
  Scenario: Existing file having content
7
64
  Given a file named "features/file_content.feature" with:
8
65
  """
@@ -42,4 +42,3 @@ Feature: Move file or directory
42
42
  """
43
43
  When I run `cucumber`
44
44
  Then the features should all pass
45
-
@@ -17,10 +17,8 @@ Feature: After command hooks
17
17
  Given I use a fixture named "cli-app"
18
18
 
19
19
  Scenario: Run a simple command with an "after(:command)"-hook
20
- Given a file named "spec/support/hooks.rb" with:
20
+ Given a file named "spec/support/aruba_config.rb" with:
21
21
  """
22
- require 'aruba'
23
-
24
22
  Aruba.configure do |config|
25
23
  config.after :command do |cmd|
26
24
  puts "after the run of `#{cmd.commandline}`"
@@ -43,4 +41,3 @@ Feature: After command hooks
43
41
  """
44
42
  after the run of `echo running`
45
43
  """
46
-
@@ -19,10 +19,8 @@ Feature: before_cmd hooks
19
19
  Given I use a fixture named "cli-app"
20
20
 
21
21
  Scenario: Run a simple command with a "before(:command)"-hook
22
- Given a file named "spec/support/hooks.rb" with:
22
+ Given a file named "spec/support/aruba_config.rb" with:
23
23
  """
24
- require 'aruba'
25
-
26
24
  Aruba.configure do |config|
27
25
  config.before :command do |cmd|
28
26
  puts "before the run of `#{cmd.commandline}`"
@@ -49,8 +47,6 @@ Feature: before_cmd hooks
49
47
  Scenario: Run a simple command with a "before(:cmd)"-hook (deprecated)
50
48
  Given a file named "spec/support/hooks.rb" with:
51
49
  """
52
- require 'aruba'
53
-
54
50
  Aruba.configure do |config|
55
51
  config.before :cmd do |cmd|
56
52
  puts "before the run of `#{cmd}`"
@@ -9,17 +9,17 @@ Feature: Getting started with RSpec and aruba
9
9
  `spec_helper.rb`. After that you only need to flag your tests with `type:
10
10
  :aruba` and some things are set up for.
11
11
 
12
- The simple integration adds some `before(:each)`-hooks for you:
12
+ The simple integration adds some `before(:each)` hooks for you:
13
13
 
14
14
  \* Setup Aruba Test directory
15
15
  \* Clear environment (ENV)
16
- \* Make HOME-variable configarable via `arub.config.home_directory`
17
- \* Configure `aruba` via `RSpec`-metadata
18
- \* Activate announcers based on `RSpec`-metadata
16
+ \* Make HOME variable configurable via `arub.config.home_directory`
17
+ \* Configure `aruba` via `RSpec` metadata
18
+ \* Activate announcers based on `RSpec` metadata
19
19
 
20
- Be careful, if you are going to use a `before(:all)`-hook to set up
21
- files/directories. Those will be deleted by the `setup_aruba`-call within
22
- the `before(:each)`-hook. Look for some custom integration further down the
20
+ Be careful, if you are going to use a `before(:all)` hook to set up
21
+ files/directories. Those will be deleted by the `setup_aruba` call within
22
+ the `before(:each)` hook. Look for some custom integration further down the
23
23
  documentation for a solution.
24
24
 
25
25
  Given a file named "spec/spec_helper.rb" with:
@@ -82,18 +82,18 @@ Feature: Getting started with RSpec and aruba
82
82
  When I run `rspec`
83
83
  Then the specs should all pass
84
84
 
85
- Scenario: Custom Integration using before(:all)-hook
85
+ Scenario: Custom Integration using before(:all) hook
86
86
 
87
- You can even use `aruba` within a `before(:all)`-hook. But again, make sure
87
+ You can even use `aruba` within a `before(:all)` hook. But again, make sure
88
88
  that `setup_aruba` is run before you use any method of `aruba`. Using
89
- `setup_aruba` both in `before(:all)`- and `before(:each)`-hook is not
90
- possible and therefor not supported:
91
-
92
- Running `setup_aruba` removes `tmp/aruba`, creates a new one `tmp/aruba`
93
- and make it the working directory. Running it within a `before(:all)`-hook,
94
- run some `aruba`-method and then run `setup_arub` again within a
95
- `before(:each)`-hook, will remove the files/directories created within the
96
- `before(:all)`-hook.
89
+ `setup_aruba` both in a `before(:all)` and a `before(:each)` hook is not
90
+ possible and therefore not supported:
91
+
92
+ Running `setup_aruba` removes `tmp/aruba`, creates a new `tmp/aruba`, and
93
+ makes that the working directory. Running it within a `before(:all)` hook,
94
+ running some `aruba` method and, then running `setup_aruba` again within a
95
+ `before(:each)` hook, will remove the files and directories created within
96
+ the `before(:all)` hook.
97
97
 
98
98
  Given a file named "spec/spec_helper.rb" with:
99
99
  """
@@ -7,7 +7,7 @@ Feature: Get path to command
7
7
  Given I use a fixture named "cli-app"
8
8
 
9
9
  Scenario: Existing executable
10
- Given an executable named "bin/cli" with:
10
+ Given an executable named "bin/aruba-test-cli" with:
11
11
  """bash
12
12
  #!/bin/bash
13
13
  exit 0
@@ -17,20 +17,20 @@ Feature: Get path to command
17
17
  require 'spec_helper'
18
18
 
19
19
  RSpec.describe 'Find path for command', :type => :aruba do
20
- it { expect(which('cli')).to match %r{tmp/aruba/cli-app/bin/cli} }
20
+ it { expect(which('aruba-test-cli')).to match %r{tmp/aruba/cli-app/bin/aruba-test-cli} }
21
21
  end
22
22
  """
23
23
  When I run `rspec`
24
24
  Then the specs should all pass
25
25
 
26
26
  Scenario: Non-existing executable
27
- Given a file named "bin/cli" does not exist
27
+ Given a file named "bin/aruba-test-cli" does not exist
28
28
  And a file named "spec/which_spec.rb" with:
29
29
  """ruby
30
30
  require 'spec_helper'
31
31
 
32
32
  RSpec.describe 'Find path for command', :type => :aruba do
33
- it { expect(which('cli')).to be_nil }
33
+ it { expect(which('aruba-test-cli')).to be_nil }
34
34
  end
35
35
  """
36
36
  When I run `rspec`
@@ -5,10 +5,10 @@ Feature: Access STDERR of command
5
5
 
6
6
  Background:
7
7
  Given I use a fixture named "cli-app"
8
- And the default aruba io wait timeout is 1 seconds
8
+ And the default aruba io wait timeout is 0.1 seconds
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
  """bash
13
13
  #!/bin/bash
14
14
  echo 'Hello, Aruba!' >&2
@@ -18,7 +18,7 @@ Feature: Access STDERR of command
18
18
  require 'spec_helper'
19
19
 
20
20
  RSpec.describe 'Run command', :type => :aruba do
21
- before(:each) { run_command('cli') }
21
+ before(:each) { run_command('aruba-test-cli') }
22
22
  before(:each) { stop_all_commands }
23
23
  it { expect(last_command_started.stderr).to start_with 'Hello' }
24
24
  end
@@ -26,19 +26,19 @@ Feature: Access STDERR of command
26
26
  When I run `rspec`
27
27
  Then the specs should all pass
28
28
 
29
- Scenario: Waiting for output to "appear" after 2 seconds
30
- Given an executable named "bin/cli" with:
29
+ Scenario: Waiting for output to appear
30
+ Given an executable named "bin/aruba-test-cli" with:
31
31
  """bash
32
32
  #!/bin/bash
33
- sleep 1
33
+ sleep 0.1
34
34
  echo 'Hello, Aruba' >&2
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, :io_wait_timeout => 2 do
41
- before(:each) { run_command('cli') }
40
+ RSpec.describe 'Run command', :type => :aruba, :io_wait_timeout => 0.2 do
41
+ before(:each) { run_command('aruba-test-cli') }
42
42
  it { expect(last_command_started.stderr).to start_with 'Hello' }
43
43
  end
44
44
  """
@@ -8,7 +8,7 @@ Feature: Access STDOUT of command
8
8
  And the default aruba io wait timeout is 1 seconds
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
  """bash
13
13
  #!/bin/bash
14
14
  echo 'Hello, Aruba!'
@@ -18,7 +18,7 @@ Feature: Access STDOUT of command
18
18
  require 'spec_helper'
19
19
 
20
20
  RSpec.describe 'Run command', :type => :aruba do
21
- before(:each) { run_command('cli') }
21
+ before(:each) { run_command('aruba-test-cli') }
22
22
  before(:each) { stop_all_commands }
23
23
  it { expect(last_command_started.stdout).to start_with 'Hello' }
24
24
  end
@@ -26,19 +26,19 @@ Feature: Access STDOUT of command
26
26
  When I run `rspec`
27
27
  Then the specs should all pass
28
28
 
29
- Scenario: Waiting for output to "appear" after 2 seconds
30
- Given an executable named "bin/cli" with:
29
+ Scenario: Waiting for output to appear
30
+ Given an executable named "bin/aruba-test-cli" with:
31
31
  """bash
32
32
  #!/bin/bash
33
- sleep 1
33
+ sleep 0.1
34
34
  echo 'Hello, Aruba'
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, :io_wait_timeout => 2 do
41
- before(:each) { run_command('cli') }
40
+ RSpec.describe 'Run command', :type => :aruba, :io_wait_timeout => 0.2 do
41
+ before(:each) { run_command('aruba-test-cli') }
42
42
  it { expect(last_command_started.stdout).to start_with 'Hello' }
43
43
  end
44
44
  """
@@ -1,6 +1,6 @@
1
1
  Feature: Run command
2
2
 
3
- To run a command use the `#run_command`-method. There are some configuration options
3
+ To run a command use the `#run_command` method. There are some configuration options
4
4
  which are relevant here:
5
5
 
6
6
  - `startup_wait_time`:
@@ -24,7 +24,7 @@ Feature: Run command
24
24
  Given I use a fixture named "cli-app"
25
25
 
26
26
  Scenario: Existing executable
27
- Given an executable named "bin/cli" with:
27
+ Given an executable named "bin/aruba-test-cli" with:
28
28
  """bash
29
29
  #!/bin/bash
30
30
  exit 0
@@ -34,7 +34,7 @@ Feature: Run command
34
34
  require 'spec_helper'
35
35
 
36
36
  RSpec.describe 'Run command', :type => :aruba do
37
- before(:each) { run_command('cli') }
37
+ before(:each) { run_command('aruba-test-cli') }
38
38
  it { expect(last_command_started).to be_successfully_executed }
39
39
  end
40
40
  """
@@ -42,7 +42,7 @@ Feature: Run command
42
42
  Then the specs should all pass
43
43
 
44
44
  Scenario: Relative path to executable
45
- Given an executable named "bin/cli" with:
45
+ Given an executable named "bin/aruba-test-cli" with:
46
46
  """bash
47
47
  #!/bin/bash
48
48
  exit 0
@@ -52,7 +52,7 @@ Feature: Run command
52
52
  require 'spec_helper'
53
53
 
54
54
  RSpec.describe 'Run command', :type => :aruba do
55
- before(:each) { run_command('bin/cli') }
55
+ before(:each) { run_command('bin/aruba-test-cli') }
56
56
  it { expect(last_command_started).to be_successfully_executed }
57
57
  end
58
58
  """
@@ -60,13 +60,13 @@ Feature: Run command
60
60
  Then the specs should all pass
61
61
 
62
62
  Scenario: Non-existing executable
63
- Given a file named "bin/cli" does not exist
63
+ Given a file named "bin/aruba-test-cli" does not exist
64
64
  And a file named "spec/run_spec.rb" with:
65
65
  """ruby
66
66
  require 'spec_helper'
67
67
 
68
68
  RSpec.describe 'Find path for command', :type => :aruba do
69
- it { expect { run_command('cli') }.to raise_error Aruba::LaunchError, /Command "cli" not found in PATH-variable/ }
69
+ it { expect { run_command('aruba-test-cli') }.to raise_error Aruba::LaunchError, /Command "aruba-test-cli" not found in PATH-variable/ }
70
70
  end
71
71
  """
72
72
  When I run `rspec`
@@ -79,12 +79,12 @@ Feature: Run command
79
79
  Otherwise methods like `#send_signal` don't work since they require the
80
80
  command to be running and have setup it's signal handler.
81
81
 
82
- Given an executable named "bin/cli" with:
82
+ Given an executable named "bin/aruba-test-cli" with:
83
83
  """bash
84
84
  #!/usr/bin/env bash
85
-
85
+
86
86
  function initialize_script {
87
- sleep 2
87
+ sleep 0.2
88
88
  }
89
89
 
90
90
  function do_some_work {
@@ -105,20 +105,25 @@ Feature: Run command
105
105
  initialize_script
106
106
  do_some_work
107
107
 
108
- while [ true ]; do sleep 1; done
108
+ while [ true ]; do sleep 0.1; done
109
109
  """
110
110
  And a file named "spec/run_spec.rb" with:
111
111
  """ruby
112
112
  require 'spec_helper'
113
113
 
114
- RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 2 do
115
- before(:each) { run_command('cli') }
116
- before(:each) { last_command_started.send_signal 'HUP' }
117
-
118
- it { expect(last_command_started).to be_successfully_executed }
119
- it { expect(last_command_started).to have_output /Hello, Aruba is working/ }
120
- it { expect(last_command_started).to have_output /Hello, Aruba here/ }
121
-
114
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 0.1, :startup_wait_time => 0.2 do
115
+ before do
116
+ run_command('aruba-test-cli')
117
+ last_command_started.send_signal 'HUP'
118
+ end
119
+
120
+ it 'runs the command with the expected results' do
121
+ aggregate_failures do
122
+ expect(last_command_started).to be_successfully_executed
123
+ expect(last_command_started).to have_output /Hello, Aruba is working/
124
+ expect(last_command_started).to have_output /Hello, Aruba here/
125
+ end
126
+ end
122
127
  end
123
128
  """
124
129
  When I run `rspec`
@@ -129,12 +134,12 @@ Feature: Run command
129
134
  If you have got a "long running" command, you should consider using the
130
135
  `exit_timeout`-option.
131
136
 
132
- Given an executable named "bin/cli" with:
137
+ Given an executable named "bin/aruba-test-cli" with:
133
138
  """bash
134
139
  #!/usr/bin/env bash
135
140
 
136
141
  function do_some_work {
137
- sleep 2
142
+ sleep 0.2
138
143
  echo "Hello, Aruba here"
139
144
  }
140
145
 
@@ -144,11 +149,15 @@ Feature: Run command
144
149
  """ruby
145
150
  require 'spec_helper'
146
151
 
147
- RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3 do
148
- before(:each) { run_command('cli') }
152
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 0.3 do
153
+ before { run_command('aruba-test-cli') }
149
154
 
150
- it { expect(last_command_started).to be_successfully_executed }
151
- it { expect(last_command_started).to have_output /Hello, Aruba here/ }
155
+ it 'runs the command with the expected results' do
156
+ aggregate_failures do
157
+ expect(last_command_started).to be_successfully_executed
158
+ expect(last_command_started).to have_output /Hello, Aruba here/
159
+ end
160
+ end
152
161
  end
153
162
  """
154
163
  When I run `rspec`
@@ -159,7 +168,7 @@ Feature: Run command
159
168
  If you commands with a long and short startup phases, you should consider
160
169
  using the `startup_wait_time`-option local to the `#run_command`-call.
161
170
 
162
- Given an executable named "bin/cli1" with:
171
+ Given an executable named "bin/aruba-test-cli1" with:
163
172
  """bash
164
173
  #!/usr/bin/env bash
165
174
 
@@ -187,7 +196,7 @@ Feature: Run command
187
196
 
188
197
  while [ true ]; do sleep 0.2; done
189
198
  """
190
- And an executable named "bin/cli2" with:
199
+ And an executable named "bin/aruba-test-cli2" with:
191
200
  """bash
192
201
  #!/usr/bin/env bash
193
202
 
@@ -220,8 +229,8 @@ Feature: Run command
220
229
  require 'spec_helper'
221
230
 
222
231
  RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1 do
223
- before(:each) { run_command('cli1', 3, 0.1, 'TERM', 2) }
224
- before(:each) { run_command('cli2', 3, 0.1, 'TERM', 1) }
232
+ before(:each) { run_command('aruba-test-cli1', 3, 0.1, 'TERM', 2) }
233
+ before(:each) { run_command('aruba-test-cli2', 3, 0.1, 'TERM', 1) }
225
234
  before(:each) { last_command_started.send_signal 'HUP' }
226
235
 
227
236
  it { expect(last_command_started).to be_successfully_executed }
@@ -238,7 +247,7 @@ Feature: Run command
238
247
  If you commands with a long and short startup phases, you should consider
239
248
  using the `startup_wait_time`-option local to the `#run_command`-call.
240
249
 
241
- Given an executable named "bin/cli1" with:
250
+ Given an executable named "bin/aruba-test-cli1" with:
242
251
  """bash
243
252
  #!/usr/bin/env bash
244
253
 
@@ -266,7 +275,7 @@ Feature: Run command
266
275
 
267
276
  while [ true ]; do sleep 0.2; done
268
277
  """
269
- And an executable named "bin/cli2" with:
278
+ And an executable named "bin/aruba-test-cli2" with:
270
279
  """bash
271
280
  #!/usr/bin/env bash
272
281
 
@@ -299,8 +308,8 @@ Feature: Run command
299
308
  require 'spec_helper'
300
309
 
301
310
  RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1 do
302
- before(:each) { run_command('cli1', :startup_wait_time => 2) }
303
- before(:each) { run_command('cli2', :startup_wait_time => 1) }
311
+ before(:each) { run_command('aruba-test-cli1', :startup_wait_time => 2) }
312
+ before(:each) { run_command('aruba-test-cli2', :startup_wait_time => 1) }
304
313
  before(:each) { last_command_started.send_signal 'HUP' }
305
314
 
306
315
  it { expect(last_command_started).to be_successfully_executed }
@@ -317,7 +326,7 @@ Feature: Run command
317
326
  If need to mix "long running" and "short running" commands, you should consider using the
318
327
  `exit_timeout`-option local to the `#run_command`-method.
319
328
 
320
- Given an executable named "bin/cli1" with:
329
+ Given an executable named "bin/aruba-test-cli1" with:
321
330
  """bash
322
331
  #!/usr/bin/env bash
323
332
 
@@ -328,7 +337,7 @@ Feature: Run command
328
337
 
329
338
  do_some_work
330
339
  """
331
- And an executable named "bin/cli2" with:
340
+ And an executable named "bin/aruba-test-cli2" with:
332
341
  """bash
333
342
  #!/usr/bin/env bash
334
343
 
@@ -343,8 +352,8 @@ Feature: Run command
343
352
  require 'spec_helper'
344
353
 
345
354
  RSpec.describe 'Run command', :type => :aruba do
346
- before(:each) { run_command('cli1', 3) }
347
- before(:each) { run_command('cli2', 1) }
355
+ before(:each) { run_command('aruba-test-cli1', 3) }
356
+ before(:each) { run_command('aruba-test-cli2', 1) }
348
357
 
349
358
  it { expect(last_command_started).to be_successfully_executed }
350
359
  it { expect(last_command_started).to have_output /Hello, Aruba here/ }
@@ -358,7 +367,7 @@ Feature: Run command
358
367
  If need to mix "long running" and "short running" commands, you should consider using the
359
368
  `exit_timeout`-option local to the `#run_command`-method.
360
369
 
361
- Given an executable named "bin/cli1" with:
370
+ Given an executable named "bin/aruba-test-cli1" with:
362
371
  """bash
363
372
  #!/usr/bin/env bash
364
373
 
@@ -369,7 +378,7 @@ Feature: Run command
369
378
 
370
379
  do_some_work
371
380
  """
372
- And an executable named "bin/cli2" with:
381
+ And an executable named "bin/aruba-test-cli2" with:
373
382
  """bash
374
383
  #!/usr/bin/env bash
375
384
 
@@ -384,8 +393,8 @@ Feature: Run command
384
393
  require 'spec_helper'
385
394
 
386
395
  RSpec.describe 'Run command', :type => :aruba do
387
- before(:each) { run_command('cli1', :exit_timeout => 3) }
388
- before(:each) { run_command('cli2', :exit_timeout => 1) }
396
+ before(:each) { run_command('aruba-test-cli1', :exit_timeout => 3) }
397
+ before(:each) { run_command('aruba-test-cli2', :exit_timeout => 1) }
389
398
 
390
399
  it { expect(last_command_started).to be_successfully_executed }
391
400
  it { expect(last_command_started).to have_output /Hello, Aruba here/ }
@@ -395,7 +404,7 @@ Feature: Run command
395
404
  Then the specs should all pass
396
405
 
397
406
  Scenario: Starting command twice fails
398
- Given an executable named "bin/cli" with:
407
+ Given an executable named "bin/aruba-test-cli" with:
399
408
  """bash
400
409
  #!/bin/bash
401
410
  exit 0
@@ -405,8 +414,8 @@ Feature: Run command
405
414
  require 'spec_helper'
406
415
 
407
416
  RSpec.describe 'Run command', :type => :aruba do
408
- before(:each) { run_command('cli') }
409
- let!(:found_command) { find_command('cli') }
417
+ before(:each) { run_command('aruba-test-cli') }
418
+ let!(:found_command) { find_command('aruba-test-cli') }
410
419
  it { expect { found_command.start }.to raise_error Aruba::CommandAlreadyStartedError }
411
420
  end
412
421
  """