From 46564d86202a21c2f87c44d6fbf1c0021e09e4ad Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Mon, 28 Jan 2019 09:14:33 +0100 Subject: [PATCH 1/6] Clean up empty app --- fixtures/empty-app/lib/cli/app.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/fixtures/empty-app/lib/cli/app.rb b/fixtures/empty-app/lib/cli/app.rb index 51bc628c3..551b00b44 100644 --- a/fixtures/empty-app/lib/cli/app.rb +++ b/fixtures/empty-app/lib/cli/app.rb @@ -1,7 +1,5 @@ require 'cli/app/version' -::Dir.glob(File.expand_path('../**/*.rb', __FILE__)).each { |f| require_relative f } - module Cli module App # Your code goes here... From 850a4507a1b7a498119cf47031f46b863a375cef Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Tue, 29 Jan 2019 09:43:02 +0100 Subject: [PATCH 2/6] Remove superfluous scenario There's no need to check output from two different commands. --- .../command/check_output_of_command.feature | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature b/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature index d00bbc361..5157355df 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature @@ -103,22 +103,7 @@ Feature: All output of commands which were executed When I run `cucumber` Then the features should all pass - @posix - Scenario: Detect exact one-line output for posix commands - Given a file named "features/output.feature" with: - """cucumber - Feature: Run command - Scenario: Run command - When I run `printf 'hello world'` - Then the output should contain exactly: - \"\"\" - hello world - \"\"\" - """ - When I run `cucumber` - Then the features should all pass - - Scenario: Detect exact one-line output for ruby commands + Scenario: Detect exact one-line output Given an executable named "bin/aruba-test-cli" with: """ruby #!/usr/bin/env ruby From 7786ea9da38f6f46821bdc45f735ec5c215dce85 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Thu, 31 Jan 2019 21:51:36 +0100 Subject: [PATCH 3/6] Remove spurious file --- features/.nav | 72 --------------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 features/.nav diff --git a/features/.nav b/features/.nav deleted file mode 100644 index e531d6964..000000000 --- a/features/.nav +++ /dev/null @@ -1,72 +0,0 @@ -- README.md -- getting_started (Getting Started): - - install.feature (Install Aruba) - - supported_programming_languages.feature (Supportet Programming Languages) -- ruby_api (Ruby API): - - expand_path.feature (#expand_path) - - cleanup_aruba_directory.feature (#setup_aruba) - - run.feature (#run) - - which.feature (#which) - - append_environment_variable.feature (#append_environment_variable) - - prepend_environment_variable.feature (#prepend_environment_variable) - - set_environment_variable.feature (#set_environment_variable) - - cd.feature (#cd) - - create_directory.feature (#create_directory) - - disk_usage.feature (#disk_usage) - - does_exist.feature (#exist?) - - is_absolute.feature (#absolute?) - - filesystem/is_directory.feature (#directory?) - - is_file.feature (#file?) - - is_relative.feature(#relative?) - - move.feature (#move) - - file_system_commands.feature - - command.feature (Before Hook) - - command.feature (After Hook) -- cucumber (Cucumber): - - debug_command.feature (Debug Commmands) - - environment_variables.feature (Environment Variables) - - flushing.feature (Flush Output) - - interactive.feature (Interactive Commands) - - all_output.feature (Command Output) - - stdout.feature (STDOUT) -- configuration (Configuration): - - exit_timeout.feature (Exit Timeout) - - fixtures_directories.feature (Fixtures Directories) - - fixtures_path_prefix.feature (Fixture Path Prefix) - - home_directory.feature (Home Directory) - - io_timeout.feature (IO Wait Timeout) - - keep_ansi.feature (Keep ANSI output) - - log_level.feature (Log Level) - - physical_block_size.feature (Physical Block Size) - - root_directory.feature (Root Directory) - - working_directory.feature (Working Directory) -- rspec (RSpec): - - getting_started.feature (Integration) - - include_an_object.feature (Matcher: Include an Object) - - have_sub_directory.feature (Matcher: Have Sub Directory) - - be_existing_file.feature (Matcher: Be Existing File) - - have_file_content.feature (Matcher: Have File Content) - - have_file_size.feature (Matcher: Have File Size) - - be_an_absolute_path.feature (Matcher: Be Absolute Path) - - be_an_existing_path.feature (Matcher: Be Existing Path) - - have_permissions.feature (Matcher: Have Permissions) - - timeouts.feature (Matcher: Timeouts) -- cucumber (Cucumber): - - announce.feature (Announce Information to User) - - exit_statuses.feature (Exit Status of Commands) - - in_process.feature (Start Commands in Process) - - run.feature (Run Commands) - - home_variable.feature (Modify HOME-Variable) - - set_environment_variable.feature (Set Environment variables) - - copy.feature (Copy files/directories) - - create_directory.feature (Create Directories) - - create_file.feature (Create Files) - - file_content.feature (Use File Content) - - move.feature (Move files/directories) - - overwrite_file.feature (Overwrite Files) - - use_fixture.feature (Use Fixtures) - - output.feature (Output) - - utf-8.feature (Support for UTF-8-strings) -- development (Development): - - build.feature (Build Aruba) - - test.feature (Test Aruba) From 001ef6c8e056b97ea18cac7b186c3af9890e2fcd Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 1 Feb 2019 09:08:08 +0100 Subject: [PATCH 4/6] Remove superfluous line from scenario --- .../cucumber/steps/command/stop_command.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature index 546955e14..6edc041c9 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature @@ -241,7 +241,6 @@ Feature: Stop commands Given the default aruba stop signal is "HUP" And the default aruba exit timeout is 0.2 seconds When I run `aruba-test-cli` - And I terminate the command started last Then the exit status should be 155 """ When I run `cucumber` From 2122267c1ddacca541eab01042b01b2e86c41438 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Wed, 27 Feb 2019 18:34:49 +0100 Subject: [PATCH 5/6] Improve scenario description --- .../environment/prepend_environment_variable.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/04_aruba_api/environment/prepend_environment_variable.feature b/features/04_aruba_api/environment/prepend_environment_variable.feature index d433753ee..e9bc96d45 100644 --- a/features/04_aruba_api/environment/prepend_environment_variable.feature +++ b/features/04_aruba_api/environment/prepend_environment_variable.feature @@ -8,7 +8,7 @@ Feature: Prepend environment variable Each variable name and each value is converted to a string. Otherwise `ruby` would complain about an invalid argument. To make use of a variable you can - either use `#run` and the like or `#with_environment`. + either use `#run_command` and the like or `#with_environment`. Background: Given I use the fixture "cli-app" From 3424c1d64e84f4d1381afc4dd121e5b34a149314 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Wed, 30 Jan 2019 06:48:42 +0100 Subject: [PATCH 6/6] Clean up several scenarios --- .../steps/command/check_output_of_command.feature | 10 ++-------- .../cucumber/steps/command/stop_command.feature | 7 ++++++- .../rspec/hooks/define_after_hook_for_commands.feature | 5 +---- .../hooks/define_before_hook_for_commands.feature | 6 +----- features/04_aruba_api/command/run_command.feature | 6 +++--- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature b/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature index 5157355df..57c0341d2 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/check_output_of_command.feature @@ -104,17 +104,11 @@ Feature: All output of commands which were executed Then the features should all pass Scenario: Detect exact one-line output - Given an executable named "bin/aruba-test-cli" with: - """ruby - #!/usr/bin/env ruby - - print "hello world" - """ - And a file named "features/output.feature" with: + Given a file named "features/output.feature" with: """cucumber Feature: Run command Scenario: Run command - When I run `aruba-test-cli` + When I run `echo 'hello world'` Then the output should contain exactly: \"\"\" hello world diff --git a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature index 6edc041c9..be9b11a3c 100644 --- a/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature +++ b/features/03_testing_frameworks/cucumber/steps/command/stop_command.feature @@ -247,7 +247,12 @@ Feature: Stop commands Then the features should all pass @unsupported-on-platform-java - Scenario: STDERR/STDOUT is written normally if output was written in "signal"-handler + Scenario: STDERR/STDOUT is captured from signal handlers + + STDERR/STDOUT is written normally on MRI if output was written in "signal"-handler + + This is currently broken on JRuby. + Given an executable named "bin/aruba-test-cli1" with: """bash #!/bin/bash diff --git a/features/03_testing_frameworks/rspec/hooks/define_after_hook_for_commands.feature b/features/03_testing_frameworks/rspec/hooks/define_after_hook_for_commands.feature index 182936ce1..b4f39c3c1 100644 --- a/features/03_testing_frameworks/rspec/hooks/define_after_hook_for_commands.feature +++ b/features/03_testing_frameworks/rspec/hooks/define_after_hook_for_commands.feature @@ -6,7 +6,6 @@ Feature: After command hooks You can hook into Aruba's lifecycle just before it runs a command and after it has run the command: ```ruby - require 'aruba' Aruba.configure do |config| config.after :command do |cmd| puts "After the run of '#{cmd}'" @@ -18,10 +17,8 @@ Feature: After command hooks Given I use a fixture named "cli-app" Scenario: Run a simple command with an "after(:command)"-hook - Given a file named "spec/support/hooks.rb" with: + Given a file named "spec/support/aruba_config.rb" with: """ - require_relative 'aruba' - Aruba.configure do |config| config.after :command do |cmd| puts "after the run of `#{cmd.commandline}`" diff --git a/features/03_testing_frameworks/rspec/hooks/define_before_hook_for_commands.feature b/features/03_testing_frameworks/rspec/hooks/define_before_hook_for_commands.feature index f1ad4235c..4a5f0953a 100644 --- a/features/03_testing_frameworks/rspec/hooks/define_before_hook_for_commands.feature +++ b/features/03_testing_frameworks/rspec/hooks/define_before_hook_for_commands.feature @@ -8,8 +8,6 @@ Feature: before_cmd hooks You can hook into Aruba's lifecycle just before it runs a command and after it has run the command: ```ruby - require_relative 'aruba' - Aruba.configure do |config| config.before :command do |cmd| puts "About to run '#{cmd}'" @@ -21,10 +19,8 @@ Feature: before_cmd hooks Given I use a fixture named "cli-app" Scenario: Run a simple command with a "before(:command)"-hook - Given a file named "spec/support/hooks.rb" with: + Given a file named "spec/support/aruba_config.rb" with: """ - require_relative 'aruba' - Aruba.configure do |config| config.before :command do |cmd| puts "before the run of `#{cmd.commandline}`" diff --git a/features/04_aruba_api/command/run_command.feature b/features/04_aruba_api/command/run_command.feature index 1e47b972a..e133b1afb 100644 --- a/features/04_aruba_api/command/run_command.feature +++ b/features/04_aruba_api/command/run_command.feature @@ -1,6 +1,6 @@ Feature: Run command - To run a command use the `#run`-method. There are some configuration options + To run a command use the `#run_command` method. There are some configuration options which are relevant here: - `startup_wait_time`: @@ -166,7 +166,7 @@ Feature: Run command Scenario: Mixing commands with long and short startup phase If you commands with a long and short startup phases, you should consider - using the `startup_wait_time`-option local to the `#run`-call. + using the `startup_wait_time`-option local to the `#run_command`-call. Given an executable named "bin/aruba-test-cli1" with: """bash @@ -255,7 +255,7 @@ Feature: Run command Scenario: Mixing long and short running commands If need to mix "long running" and "short running" commands, you should consider using the - `exit_timeout`-option local to the `#run`-method. + `exit_timeout`-option local to the `#run_command`-method. Given an executable named "bin/aruba-test-cli1" with: """bash