From ff2044ac645be941738dfc8608b373466ed49c60 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Fri, 27 Apr 2018 19:23:35 +0200 Subject: [PATCH 1/3] Move Api::Commands to its logical file name --- lib/aruba/api.rb | 2 +- lib/aruba/api/{command.rb => commands.rb} | 0 lib/aruba/api/rvm.rb | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename lib/aruba/api/{command.rb => commands.rb} (100%) diff --git a/lib/aruba/api.rb b/lib/aruba/api.rb index 2c5d77775..3d89f547f 100644 --- a/lib/aruba/api.rb +++ b/lib/aruba/api.rb @@ -6,7 +6,7 @@ require 'aruba/platform' require 'aruba/api/core' -require 'aruba/api/command' +require 'aruba/api/commands' if Aruba::VERSION <= '1.0.0' require 'aruba/api/deprecated' diff --git a/lib/aruba/api/command.rb b/lib/aruba/api/commands.rb similarity index 100% rename from lib/aruba/api/command.rb rename to lib/aruba/api/commands.rb diff --git a/lib/aruba/api/rvm.rb b/lib/aruba/api/rvm.rb index 00e8ef7c0..50bc40468 100644 --- a/lib/aruba/api/rvm.rb +++ b/lib/aruba/api/rvm.rb @@ -1,5 +1,5 @@ require 'aruba/api/environment' -require 'aruba/api/command' +require 'aruba/api/commands' # Aruba module Aruba From 507b353b678b7f20d2df87bf43602313ef4c7529 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sun, 27 Jan 2019 16:13:49 +0100 Subject: [PATCH 2/3] Rename #run and #run_simple, with deprecation --- lib/aruba/api/commands.rb | 4 +-- lib/aruba/api/deprecated.rb | 68 +++++++++++++++++++++++++++++++++++-- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/lib/aruba/api/commands.rb b/lib/aruba/api/commands.rb index c29ad80d2..309c435bb 100644 --- a/lib/aruba/api/commands.rb +++ b/lib/aruba/api/commands.rb @@ -136,7 +136,7 @@ def find_command(commandline) # # rubocop:disable Metrics/MethodLength # rubocop:disable Metrics/CyclomaticComplexity - def run(*args) + def run_command(*args) fail ArgumentError, 'Please pass at least a command as first argument.' if args.size < 1 cmd = args.shift @@ -243,7 +243,7 @@ def run(*args) # # rubocop:disable Metrics/CyclomaticComplexity # rubocop:disable Metrics/MethodLength - def run_simple(*args) + def run_command_and_stop(*args) fail ArgumentError, 'Please pass at least a command as first argument.' if args.size < 1 cmd = args.shift diff --git a/lib/aruba/api/deprecated.rb b/lib/aruba/api/deprecated.rb index 5a36b6602..5a5847143 100644 --- a/lib/aruba/api/deprecated.rb +++ b/lib/aruba/api/deprecated.rb @@ -116,13 +116,75 @@ def eot # The command to by run # # @see #cmd - # @deprectated + # @deprecated def run_interactive(cmd) - Aruba.platform.deprecated('The use of "#run_interactive" is deprecated. You can simply use "run" instead') + Aruba.platform.deprecated('The use of "#run_interactive" is deprecated. You can simply use "run_command" instead') + + run_command(cmd) + end + + # Run given command and stop it if timeout is reached + # + # @param [String] cmd + # The command which should be executed + # + # @param [Hash] opts + # Options + # + # @option [Integer] exit_timeout + # If the timeout is reached the command will be killed + # + # @option [Integer] io_wait_timeout + # Wait for IO to finish + # + # @option [Integer] startup_wait_time + # Wait for a command to start + # + # @option [String] stop_signal + # Use signal to stop command + # + # @yield [SpawnProcess] + # Run block with process + # + # @see #run_command + # @deprecated + def run(*args) + Aruba.platform.deprecated( + 'The use of "#run" is deprecated. Use "run_command" instead') - run(cmd) + run_command(*args) end + # Run a command with aruba + # + # Checks for error during command execution and checks the output to detect + # an timeout error. + # + # @param [String] cmd + # The command to be executed + # + # @param [Hash] options + # Options for aruba + # + # @option [TrueClass,FalseClass] fail_on_error + # Should aruba fail on error? + # + # @option [Integer] exit_timeout + # Timeout for execution + # + # @option [Integer] io_wait_timeout + # Timeout for IO - STDERR, STDOUT + # + # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/MethodLength + def run_simple(*args) + Aruba.platform.deprecated( + 'The use of "#run_simple" is deprecated. Use "run_command_and_stop" instead') + + run_command_and_stop(*args) + end + + # @deprecated # Create an empty file # From 1284c68f234cfa9446371a427cef8701024fb940 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sun, 27 Jan 2019 18:38:51 +0100 Subject: [PATCH 3/3] Use non-deprecated run methods everywhere --- features/api/command/find_command.feature | 10 ++--- .../api/command/last_command_started.feature | 6 +-- .../api/command/last_command_stopped.feature | 12 ++--- features/api/command/run.feature | 44 +++++++++---------- features/api/command/run_simple.feature | 24 +++++----- features/api/command/send_signal.feature | 4 +- features/api/command/stderr.feature | 4 +- features/api/command/stdout.feature | 4 +- features/api/command/stop.feature | 8 ++-- .../api/command/stop_all_commands.feature | 10 ++--- .../command/terminate_all_commands.feature | 10 ++--- .../append_environment_variable.feature | 10 ++--- .../delete_environment_variable.feature | 6 +-- .../prepend_environment_variable.feature | 12 ++--- .../set_environment_variable.feature | 30 ++++++------- features/api/filesystem/cd.feature | 4 +- features/api/text/extract_text.feature | 8 ++-- features/api/text/replace_variables.feature | 2 +- features/api/text/sanitize_text.feature | 22 +++++----- features/api/text/unescape_text.feature | 12 ++--- .../command_runtime_environment.feature | 10 ++--- features/configuration/usage.feature | 10 ++--- features/hooks/after/command.feature | 2 +- features/hooks/before/command.feature | 4 +- features/matchers/timeouts.feature | 4 +- features/step_definitions/aruba_dev_steps.rb | 2 +- lib/aruba/api/commands.rb | 7 +-- lib/aruba/api/rvm.rb | 4 +- lib/aruba/cucumber/command.rb | 12 ++--- spec/aruba/api_spec.rb | 12 ++--- spec/aruba/matchers/command_spec.rb | 30 ++++++------- 31 files changed, 170 insertions(+), 169 deletions(-) diff --git a/features/api/command/find_command.feature b/features/api/command/find_command.feature index defd13673..324e2a766 100644 --- a/features/api/command/find_command.feature +++ b/features/api/command/find_command.feature @@ -11,7 +11,7 @@ Feature: Find a started command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('echo hello') } + before(:each) { run_command('echo hello') } let(:command) { find_command('echo hello') } before(:each) { stop_all_commands } @@ -44,8 +44,8 @@ Feature: Find a started command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('echo hello1') } - before(:each) { run('echo hello2') } + before(:each) { run_command('echo hello1') } + before(:each) { run_command('echo hello2') } let(:command) { find_command('echo hello1') } before(:each) { stop_all_commands } @@ -67,9 +67,9 @@ Feature: Find a started command RSpec.describe 'Run command', :type => :aruba do before(:each) { set_environment_variable 'ENV_VAR', '1' } - before(:each) { run('bash -c "echo -n $ENV_VAR"') } + before(:each) { run_command('bash -c "echo -n $ENV_VAR"') } before(:each) { set_environment_variable 'ENV_VAR', '2' } - before(:each) { run('bash -c "echo -n $ENV_VAR"') } + before(:each) { run_command('bash -c "echo -n $ENV_VAR"') } let(:command) { find_command('bash -c "echo -n $ENV_VAR"') } diff --git a/features/api/command/last_command_started.feature b/features/api/command/last_command_started.feature index 559f10327..7a14e5dcb 100644 --- a/features/api/command/last_command_started.feature +++ b/features/api/command/last_command_started.feature @@ -9,7 +9,7 @@ Feature: Return last command started require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('echo hello') } + before(:each) { run_command('echo hello') } before(:each) { stop_all_commands } it { expect(last_command_started).to be_successfully_executed } @@ -25,8 +25,8 @@ Feature: Return last command started require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('echo hello') } - before(:each) { run('echo world') } + before(:each) { run_command('echo hello') } + before(:each) { run_command('echo world') } before(:each) { stop_all_commands } diff --git a/features/api/command/last_command_stopped.feature b/features/api/command/last_command_stopped.feature index 769d61703..8aecea943 100644 --- a/features/api/command/last_command_stopped.feature +++ b/features/api/command/last_command_stopped.feature @@ -9,7 +9,7 @@ Feature: Return last command stopped require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('echo hello') } + before(:each) { run_command('echo hello') } before(:each) { stop_all_commands } it { expect(last_command_stopped).to be_successfully_executed } @@ -25,8 +25,8 @@ Feature: Return last command stopped require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('echo hello') } - before(:each) { run('echo world') } + before(:each) { run_command('echo hello') } + before(:each) { run_command('echo world') } before(:each) { stop_all_commands } @@ -43,9 +43,9 @@ Feature: Return last command stopped require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('echo hello') } + before(:each) { run_command('echo hello') } before(:each) { find_command('echo hello').stop } - before(:each) { run('echo world') } + before(:each) { run_command('echo world') } it { expect(last_command_stopped).to be_successfully_executed } it { expect(last_command_stopped.commandline).to eq 'echo hello' } @@ -80,7 +80,7 @@ Feature: Return last command stopped require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect{ last_command_stopped.commandline }.to raise_error Aruba::NoCommandHasBeenStoppedError } end diff --git a/features/api/command/run.feature b/features/api/command/run.feature index 9ae8cf46a..33bb0f3fa 100644 --- a/features/api/command/run.feature +++ b/features/api/command/run.feature @@ -1,15 +1,15 @@ 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`: Given this option `aruba` waits n seconds after it started the command. - This is most useful when using `#run()` and not really makes sense for - `#run_simple()`. + This is most useful when using `#run_command()` and not really makes sense for + `#run_command_and_stop()`. - You can use `#run()` + `startup_wait_time` to start background jobs. + You can use `#run_command()` + `startup_wait_time` to start background jobs. - `exit_timeout`: @@ -34,7 +34,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect(last_command_started).to be_successfully_executed } end """ @@ -52,7 +52,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('bin/cli') } + before(:each) { run_command('bin/cli') } it { expect(last_command_started).to be_successfully_executed } end """ @@ -66,7 +66,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Find path for command', :type => :aruba do - it { expect { run('cli') }.to raise_error Aruba::LaunchError, /Command "cli" not found in PATH-variable/ } + it { expect { run_command('cli') }.to raise_error Aruba::LaunchError, /Command "cli" not found in PATH-variable/ } end """ When I run `rspec` @@ -112,7 +112,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 2 do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { last_command_started.send_signal 'HUP' } it { expect(last_command_started).to be_successfully_executed } @@ -145,7 +145,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3 do - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect(last_command_started).to be_successfully_executed } it { expect(last_command_started).to have_output /Hello, Aruba here/ } @@ -157,7 +157,7 @@ Feature: Run command Scenario: Mixing commands with long and short startup phase (deprecated) 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/cli1" with: """bash @@ -220,8 +220,8 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1 do - before(:each) { run('cli1', 3, 0.1, 'TERM', 2) } - before(:each) { run('cli2', 3, 0.1, 'TERM', 1) } + before(:each) { run_command('cli1', 3, 0.1, 'TERM', 2) } + before(:each) { run_command('cli2', 3, 0.1, 'TERM', 1) } before(:each) { last_command_started.send_signal 'HUP' } it { expect(last_command_started).to be_successfully_executed } @@ -236,7 +236,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/cli1" with: """bash @@ -299,8 +299,8 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1 do - before(:each) { run('cli1', :startup_wait_time => 2) } - before(:each) { run('cli2', :startup_wait_time => 1) } + before(:each) { run_command('cli1', :startup_wait_time => 2) } + before(:each) { run_command('cli2', :startup_wait_time => 1) } before(:each) { last_command_started.send_signal 'HUP' } it { expect(last_command_started).to be_successfully_executed } @@ -315,7 +315,7 @@ Feature: Run command Scenario: Mixing long and short running commands (deprecated) 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/cli1" with: """bash @@ -343,8 +343,8 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli1', 3) } - before(:each) { run('cli2', 1) } + before(:each) { run_command('cli1', 3) } + before(:each) { run_command('cli2', 1) } it { expect(last_command_started).to be_successfully_executed } it { expect(last_command_started).to have_output /Hello, Aruba here/ } @@ -356,7 +356,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/cli1" with: """bash @@ -384,8 +384,8 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli1', :exit_timeout => 3) } - before(:each) { run('cli2', :exit_timeout => 1) } + before(:each) { run_command('cli1', :exit_timeout => 3) } + before(:each) { run_command('cli2', :exit_timeout => 1) } it { expect(last_command_started).to be_successfully_executed } it { expect(last_command_started).to have_output /Hello, Aruba here/ } @@ -405,7 +405,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } let!(:found_command) { find_command('cli') } it { expect { found_command.start }.to raise_error Aruba::CommandAlreadyStartedError } end diff --git a/features/api/command/run_simple.feature b/features/api/command/run_simple.feature index 1057f89f3..d7e2d703e 100644 --- a/features/api/command/run_simple.feature +++ b/features/api/command/run_simple.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_and_stop`-method. There are some configuration options which are relevant here: - `fail_on_error`: @@ -23,7 +23,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - it { expect { run_simple('cli') }.to raise_error RSpec::Expectations::ExpectationNotMetError } + it { expect { run_command_and_stop('cli') }.to raise_error RSpec::Expectations::ExpectationNotMetError } end """ When I run `rspec` @@ -40,7 +40,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - it { expect { run_simple('cli', :fail_on_error => true) }.to raise_error } + it { expect { run_command_and_stop('cli', :fail_on_error => true) }.to raise_error } end """ When I run `rspec` @@ -57,7 +57,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - it { expect { run_simple('cli', true) }.to raise_error } + it { expect { run_command_and_stop('cli', true) }.to raise_error } end """ When I run `rspec` @@ -74,7 +74,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - it { expect { run_simple('cli', :fail_on_error => false) }.not_to raise_error } + it { expect { run_command_and_stop('cli', :fail_on_error => false) }.not_to raise_error } end """ When I run `rspec` @@ -91,7 +91,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - it { expect { run_simple('cli', false) }.not_to raise_error } + it { expect { run_command_and_stop('cli', false) }.not_to raise_error } end """ When I run `rspec` @@ -126,7 +126,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 2 do - before(:each) { run_simple('cli') } + before(:each) { run_command_and_stop('cli') } it { expect(last_command_started).to be_successfully_executed } it { expect(last_command_started).to have_output /Hello, Aruba is working/ } @@ -156,7 +156,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3 do - before(:each) { run_simple('cli') } + before(:each) { run_command_and_stop('cli') } it { expect(last_command_started).to be_successfully_executed } it { expect(last_command_started).to have_output /Hello, Aruba here/ } @@ -165,10 +165,10 @@ Feature: Run command When I run `rspec` Then the specs should all pass - Scenario: Sending signals to commands started with `#run_simple()` + Scenario: Sending signals to commands started with `#run_command_and_stop()` Sending signals to a command which is started by - `#run_simple()` does not make sense. The command is stopped internally when + `#run_command_and_stop()` does not make sense. The command is stopped internally when its exit status is checked. Given an executable named "bin/cli" with: @@ -199,7 +199,7 @@ Feature: Run command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2, :startup_wait_time => 1 do - before(:each) { run_simple('cli') } + before(:each) { run_command_and_stop('cli') } it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError } end """ @@ -224,7 +224,7 @@ Feature: Run command end RSpec.describe 'Run command', :type => :aruba do - it { expect { run_simple('cli', :fail_on_error => true) }.to_not raise_error } + it { expect { run_command_and_stop('cli', :fail_on_error => true) }.to_not raise_error } end """ When I run `rspec` diff --git a/features/api/command/send_signal.feature b/features/api/command/send_signal.feature index 9e9026acb..88f2ac4b7 100644 --- a/features/api/command/send_signal.feature +++ b/features/api/command/send_signal.feature @@ -26,7 +26,7 @@ Feature: Send running command a signal require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 5 do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { last_command_started.send_signal 'HUP' } it { expect(last_command_started).to have_output /Exit/ } end @@ -45,7 +45,7 @@ Feature: Send running command a signal require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 5 do - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError, /Command "cli" with PID/ } end """ diff --git a/features/api/command/stderr.feature b/features/api/command/stderr.feature index 3b95a1298..50c8447f1 100644 --- a/features/api/command/stderr.feature +++ b/features/api/command/stderr.feature @@ -18,7 +18,7 @@ Feature: Access STDERR of command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(last_command_started.stderr).to start_with 'Hello' } end @@ -38,7 +38,7 @@ Feature: Access STDERR of command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :io_wait_timeout => 2 do - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect(last_command_started.stderr).to start_with 'Hello' } end """ diff --git a/features/api/command/stdout.feature b/features/api/command/stdout.feature index 150a89357..e6f6dd17a 100644 --- a/features/api/command/stdout.feature +++ b/features/api/command/stdout.feature @@ -18,7 +18,7 @@ Feature: Access STDOUT of command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(last_command_started.stdout).to start_with 'Hello' } end @@ -38,7 +38,7 @@ Feature: Access STDOUT of command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :io_wait_timeout => 2 do - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect(last_command_started.stdout).to start_with 'Hello' } end """ diff --git a/features/api/command/stop.feature b/features/api/command/stop.feature index ec633c76a..1179727cd 100644 --- a/features/api/command/stop.feature +++ b/features/api/command/stop.feature @@ -28,7 +28,7 @@ Feature: Stop command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { last_command_started.stop } it { expect(last_command_started).to be_successfully_executed } end @@ -52,7 +52,7 @@ Feature: Stop command require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { find_command('cli').stop } it { expect(last_command_started).to be_successfully_executed } end @@ -88,7 +88,7 @@ Feature: Stop command end RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect(last_command_started).to be_successfully_executed } end """ @@ -123,7 +123,7 @@ Feature: Stop command end RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect(last_command_started).to have_exit_status 2 } end """ diff --git a/features/api/command/stop_all_commands.feature b/features/api/command/stop_all_commands.feature index 27035bc44..7cea87aea 100644 --- a/features/api/command/stop_all_commands.feature +++ b/features/api/command/stop_all_commands.feature @@ -16,8 +16,8 @@ Feature: Stop all commands require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 5 do - before(:each) { run('cli') } - before(:each) { run('cli') } + before(:each) { run_command('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } @@ -38,9 +38,9 @@ Feature: Stop all commands require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2 do - before(:each) { @cmd1 = run('cli') } - before(:each) { @cmd2 = run('cli') } - before(:each) { @cmd3 = run('sleep 1') } + before(:each) { @cmd1 = run_command('cli') } + before(:each) { @cmd2 = run_command('cli') } + before(:each) { @cmd3 = run_command('sleep 1') } before(:each) { stop_all_commands { |c| c.commandline == 'cli' } } diff --git a/features/api/command/terminate_all_commands.feature b/features/api/command/terminate_all_commands.feature index 31bf0a935..c87b7364b 100644 --- a/features/api/command/terminate_all_commands.feature +++ b/features/api/command/terminate_all_commands.feature @@ -16,8 +16,8 @@ Feature: Terminate all commands require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 5 do - before(:each) { run('cli') } - before(:each) { run('cli') } + before(:each) { run_command('cli') } + before(:each) { run_command('cli') } before(:each) { terminate_all_commands } @@ -38,9 +38,9 @@ Feature: Terminate all commands require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2 do - before(:each) { @cmd1 = run('cli') } - before(:each) { @cmd2 = run('cli') } - before(:each) { @cmd3 = run('sleep 1') } + before(:each) { @cmd1 = run_command('cli') } + before(:each) { @cmd2 = run_command('cli') } + before(:each) { @cmd3 = run_command('sleep 1') } before(:each) { terminate_all_commands { |c| c.commandline == 'cli' } } diff --git a/features/api/environment/append_environment_variable.feature b/features/api/environment/append_environment_variable.feature index 3e27fb381..6abbd1505 100644 --- a/features/api/environment/append_environment_variable.feature +++ b/features/api/environment/append_environment_variable.feature @@ -21,7 +21,7 @@ Feature: Append environment variable RSpec.describe 'Long running command', :type => :aruba do before(:each) { append_environment_variable 'LONG_LONG_VARIABLE', 'a' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=a' } @@ -39,7 +39,7 @@ Feature: Append environment variable before(:each) { append_environment_variable 'LONG_LONG_VARIABLE', 'a' } before(:each) { append_environment_variable 'LONG_LONG_VARIABLE', 'b' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=ab' } @@ -59,7 +59,7 @@ Feature: Append environment variable RSpec.describe 'Long running command', :type => :aruba do before(:each) { append_environment_variable 'REALLY_LONG_LONG_VARIABLE', 'b' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'REALLY_LONG_LONG_VARIABLE=ab' } @@ -81,7 +81,7 @@ Feature: Append environment variable RSpec.describe 'Long running command', :type => :aruba do before(:each) { append_environment_variable 'REALLY_LONG_LONG_VARIABLE', 'b' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it do @@ -111,7 +111,7 @@ Feature: Append environment variable RSpec.describe 'Long running command', :type => :aruba do before(:each) { append_environment_variable 'REALLY_LONG_LONG_VARIABLE', 'b' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it do diff --git a/features/api/environment/delete_environment_variable.feature b/features/api/environment/delete_environment_variable.feature index 657c43d92..031389913 100644 --- a/features/api/environment/delete_environment_variable.feature +++ b/features/api/environment/delete_environment_variable.feature @@ -15,7 +15,7 @@ Feature: Delete existing environment variable via API-method RSpec.describe 'Long running command', :type => :aruba do before(:each) { delete_environment_variable 'LONG_LONG_VARIABLE' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).not_to include 'LONG_LONG_VARIABLE=1' } @@ -33,7 +33,7 @@ Feature: Delete existing environment variable via API-method before(:each) { set_environment_variable 'LONG_LONG_VARIABLE', '1' } before(:each) { delete_environment_variable 'LONG_LONG_VARIABLE' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).not_to include 'LONG_LONG_VARIABLE' } @@ -53,7 +53,7 @@ Feature: Delete existing environment variable via API-method RSpec.describe 'Environment command', :type => :aruba do before(:each) { delete_environment_variable 'REALLY_LONG_LONG_VARIABLE' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).not_to include 'REALLY_LONG_LONG_VARIABLE' } diff --git a/features/api/environment/prepend_environment_variable.feature b/features/api/environment/prepend_environment_variable.feature index 0e4b29c06..e9bc96d45 100644 --- a/features/api/environment/prepend_environment_variable.feature +++ b/features/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" @@ -21,7 +21,7 @@ Feature: Prepend environment variable RSpec.describe 'Long running command', :type => :aruba do before(:each) { prepend_environment_variable 'LONG_LONG_VARIABLE', 'a' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=a' } @@ -39,7 +39,7 @@ Feature: Prepend environment variable before(:each) { prepend_environment_variable 'LONG_LONG_VARIABLE', 'a' } before(:each) { prepend_environment_variable 'LONG_LONG_VARIABLE', 'b' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=ba' } @@ -59,7 +59,7 @@ Feature: Prepend environment variable RSpec.describe 'Long running command', :type => :aruba do before(:each) { prepend_environment_variable 'REALLY_LONG_LONG_VARIABLE', 'b' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'REALLY_LONG_LONG_VARIABLE=ba' } @@ -81,7 +81,7 @@ Feature: Prepend environment variable RSpec.describe 'Long running command', :type => :aruba do before(:each) { prepend_environment_variable 'REALLY_LONG_LONG_VARIABLE', 'b' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it do @@ -111,7 +111,7 @@ Feature: Prepend environment variable RSpec.describe 'Long running command', :type => :aruba do before(:each) { prepend_environment_variable 'REALLY_LONG_LONG_VARIABLE', 'b' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it do diff --git a/features/api/environment/set_environment_variable.feature b/features/api/environment/set_environment_variable.feature index 8fd722ad3..77bb376ce 100644 --- a/features/api/environment/set_environment_variable.feature +++ b/features/api/environment/set_environment_variable.feature @@ -20,7 +20,7 @@ Feature: Set environment variable via API-method RSpec.describe 'Environment command', :type => :aruba do before(:each) { set_environment_variable 'LONG_LONG_VARIABLE', '1' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=1' } @@ -38,7 +38,7 @@ Feature: Set environment variable via API-method before(:each) { set_environment_variable 'LONG_LONG_VARIABLE', '1' } before(:each) { set_environment_variable 'LONG_LONG_VARIABLE', '2' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=2' } @@ -59,7 +59,7 @@ Feature: Set environment variable via API-method RSpec.describe 'Environment command', :type => :aruba do before(:each) { set_environment_variable 'REALLY_LONG_LONG_VARIABLE', '2' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'REALLY_LONG_LONG_VARIABLE=2' } @@ -78,7 +78,7 @@ Feature: Set environment variable via API-method RSpec.describe 'Environment command', :type => :aruba do before(:each) { ENV['REALLY_LONG_LONG_VARIABLE'] = '2' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'REALLY_LONG_LONG_VARIABLE=2' } @@ -100,7 +100,7 @@ Feature: Set environment variable via API-method before(:each) { set_environment_variable 'REALLY_LONG_LONG_VARIABLE', '1' } before(:each) { ENV['REALLY_LONG_LONG_VARIABLE'] = '2' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'REALLY_LONG_LONG_VARIABLE=1' } @@ -123,7 +123,7 @@ Feature: Set environment variable via API-method RSpec.describe 'Environment command', :type => :aruba do before(:each) { set_environment_variable 'REALLY_LONG_LONG_VARIABLE', '2' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it do @@ -153,7 +153,7 @@ Feature: Set environment variable via API-method RSpec.describe 'Environment command', :type => :aruba do before(:each) { set_environment_variable 'REALLY_LONG_LONG_VARIABLE', '2' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it do @@ -181,7 +181,7 @@ Feature: Set environment variable via API-method before(:each) { set_environment_variable 'LONG_LONG_VARIABLE', '1' } describe 'Method XX' do - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=1' } @@ -190,7 +190,7 @@ Feature: Set environment variable via API-method describe 'Method YY' do before(:each) { set_environment_variable 'LONG_LONG_VARIABLE', '2' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=2' } @@ -210,7 +210,7 @@ Feature: Set environment variable via API-method RSpec.describe 'Environment command', :type => :aruba do before(:each) { set_environment_variable 'REALLY_LONG_LONG_VARIABLE', '2' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it do @@ -283,7 +283,7 @@ Feature: Set environment variable via API-method it { expect(ENV['REALLY_LONG_LONG_VARIABLE']).to eq '1' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'REALLY_LONG_LONG_VARIABLE=1' } @@ -298,7 +298,7 @@ Feature: Set environment variable via API-method it { expect(ENV['LONG_LONG_VARIABLE']).to eq '2' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'REALLY_LONG_LONG_VARIABLE=1' } @@ -317,7 +317,7 @@ Feature: Set environment variable via API-method RSpec.describe 'Environment command', :type => :aruba do before(:each) { set_environment_variable 'long_LONG_VARIABLE', '1' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'long_LONG_VARIABLE=1' } @@ -336,7 +336,7 @@ Feature: Set environment variable via API-method RSpec.describe 'Environment command', :type => :aruba do before(:each) { set_environment_variable 'long_LONG_VARIABLE', '1' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=1' } @@ -362,7 +362,7 @@ Feature: Set environment variable via API-method require 'my_library' end - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=1' } diff --git a/features/api/filesystem/cd.feature b/features/api/filesystem/cd.feature index 78c49ec1e..d1a98b74c 100644 --- a/features/api/filesystem/cd.feature +++ b/features/api/filesystem/cd.feature @@ -24,7 +24,7 @@ Feature: Change current working directory cd 'new_dir.d' end - before(:each) { run_simple 'pwd' } + before(:each) { run_command_and_stop 'pwd' } it { expect(last_command_started.output).to include 'new_dir.d' } end @@ -39,7 +39,7 @@ Feature: Change current working directory RSpec.describe 'cd to directory', :type => :aruba do before(:each) { cd 'new_dir.d' } - before(:each) { run_simple 'pwd' } + before(:each) { run_command_and_stop 'pwd' } it { expect(last_command_started.output).to include 'new_dir.d' } it { expect(last_command_started).to be_executed_in_time } diff --git a/features/api/text/extract_text.feature b/features/api/text/extract_text.feature index 9f34cf381..809ef30cd 100644 --- a/features/api/text/extract_text.feature +++ b/features/api/text/extract_text.feature @@ -17,7 +17,7 @@ Feature: Extract text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(extract_text(unescape_text(last_command.output))).to eq "Text" } @@ -37,7 +37,7 @@ Feature: Extract text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(extract_text(unescape_text(last_command.output))).to eq "Text" } @@ -57,7 +57,7 @@ Feature: Extract text from output # require 'spec_helper' # # RSpec.describe 'Run command', :type => :aruba do - # before(:each) { run('cli') } + # before(:each) { run_command('cli') } # before(:each) { stop_all_commands } # # it { expect(extract_text(unescape_text(last_command.output))).to eq "Text" } @@ -77,7 +77,7 @@ Feature: Extract text from output # require 'spec_helper' # # RSpec.describe 'Run command', :type => :aruba do - # before(:each) { run('cli') } + # before(:each) { run_command('cli') } # before(:each) { stop_all_commands } # # it { expect(extract_text(unescape_text(last_command.output))).to eq "Text" } diff --git a/features/api/text/replace_variables.feature b/features/api/text/replace_variables.feature index dae4d8622..61d99d9c1 100644 --- a/features/api/text/replace_variables.feature +++ b/features/api/text/replace_variables.feature @@ -22,7 +22,7 @@ Feature: Replace variables require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(replace_variables('')).to eq last_command_started.pid.to_s } diff --git a/features/api/text/sanitize_text.feature b/features/api/text/sanitize_text.feature index e83b0f46a..250a60076 100644 --- a/features/api/text/sanitize_text.feature +++ b/features/api/text/sanitize_text.feature @@ -18,7 +18,7 @@ Feature: Sanitize text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(sanitize_text(last_command_started.output)).to eq "text\ntext" } @@ -38,7 +38,7 @@ Feature: Sanitize text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(sanitize_text(last_command_started.output)).to eq "texttext" } @@ -58,7 +58,7 @@ Feature: Sanitize text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(sanitize_text(last_command_started.output)).to eq "text\"text" } @@ -78,7 +78,7 @@ Feature: Sanitize text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(sanitize_text(last_command_started.output)).to eq "texttext" } @@ -98,7 +98,7 @@ Feature: Sanitize text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(sanitize_text(last_command_started.output)).to eq "texttext" } @@ -118,7 +118,7 @@ Feature: Sanitize text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(sanitize_text(last_command_started.output)).to eq "texttext" } @@ -138,7 +138,7 @@ Feature: Sanitize text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(sanitize_text(last_command_started.output)).to eq "Text" } @@ -158,7 +158,7 @@ Feature: Sanitize text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(sanitize_text(last_command_started.output)).to eq "Text" } @@ -178,7 +178,7 @@ Feature: Sanitize text from output require 'spec_helper' RSpec.describe 'Run command', :type => :aruba, :remove_ansi_escape_sequences => false, :keep_ansi => true do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(sanitize_text(last_command_started.output)).to eq "\e[31mText" } @@ -198,7 +198,7 @@ Feature: Sanitize text from output # require 'spec_helper' # # RSpec.describe 'Run command', :type => :aruba do - # before(:each) { run('cli') } + # before(:each) { run_command('cli') } # before(:each) { stop_all_commands } # # it { expect(sanitize_text(last_command_started.output)).to eq "Text" } @@ -218,7 +218,7 @@ Feature: Sanitize text from output # require 'spec_helper' # # RSpec.describe 'Run command', :type => :aruba do - # before(:each) { run('cli') } + # before(:each) { run_command('cli') } # before(:each) { stop_all_commands } # # it { expect(sanitize_text(last_command_started.output)).to eq "Text" } diff --git a/features/api/text/unescape_text.feature b/features/api/text/unescape_text.feature index e5bde0547..0c7e9f4c1 100644 --- a/features/api/text/unescape_text.feature +++ b/features/api/text/unescape_text.feature @@ -17,7 +17,7 @@ Feature: Unescape special characters in text require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(unescape_text(last_command.output)).to eq "text\ntext" } @@ -37,7 +37,7 @@ Feature: Unescape special characters in text require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(unescape_text(last_command.output)).to eq "texttext" } @@ -57,7 +57,7 @@ Feature: Unescape special characters in text require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(unescape_text(last_command.output)).to eq "text\"text" } @@ -77,7 +77,7 @@ Feature: Unescape special characters in text require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(unescape_text(last_command.output)).to eq "texttext" } @@ -97,7 +97,7 @@ Feature: Unescape special characters in text require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(unescape_text(last_command.output)).to eq "texttext" } @@ -117,7 +117,7 @@ Feature: Unescape special characters in text require 'spec_helper' RSpec.describe 'Run command', :type => :aruba do - before(:each) { run('cli') } + before(:each) { run_command('cli') } before(:each) { stop_all_commands } it { expect(unescape_text(last_command.output)).to eq "texttext" } diff --git a/features/configuration/command_runtime_environment.feature b/features/configuration/command_runtime_environment.feature index 8967d5ff6..1d1cc337c 100644 --- a/features/configuration/command_runtime_environment.feature +++ b/features/configuration/command_runtime_environment.feature @@ -27,7 +27,7 @@ Feature: Define default process environment end RSpec.describe 'Environment command', :type => :aruba do - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=x' } @@ -50,7 +50,7 @@ Feature: Define default process environment RSpec.describe 'Environment command', :type => :aruba do before(:each) { set_environment_variable 'LONG_LONG_VARIABLE', 'z' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=z' } @@ -73,7 +73,7 @@ Feature: Define default process environment RSpec.describe 'Environment command', :type => :aruba do before(:each) { append_environment_variable 'LONG_LONG_VARIABLE', 'z' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=xz' } @@ -96,7 +96,7 @@ Feature: Define default process environment RSpec.describe 'Environment command', :type => :aruba do before(:each) { prepend_environment_variable 'LONG_LONG_VARIABLE', 'z' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).to include 'LONG_LONG_VARIABLE=zx' } @@ -119,7 +119,7 @@ Feature: Define default process environment RSpec.describe 'Environment command', :type => :aruba do before(:each) { delete_environment_variable 'LONG_LONG_VARIABLE' } - before(:each) { run('env') } + before(:each) { run_command('env') } before(:each) { stop_all_commands } it { expect(last_command_started.output).not_to include 'LONG_LONG_VARIABLE' } diff --git a/features/configuration/usage.feature b/features/configuration/usage.feature index 1d4676f25..d0b3045f9 100644 --- a/features/configuration/usage.feature +++ b/features/configuration/usage.feature @@ -35,12 +35,12 @@ Feature: Usage of configuration RSpec.describe 'Run command', :type => :aruba do context 'when fast command' do - before(:each) { run('cli 0') } + before(:each) { run_command('cli 0') } it { expect(last_command_started).to be_successfully_executed } end context 'when slow command' do - before(:each) { run('cli 2') } + before(:each) { run_command('cli 2') } it { expect(last_command_started).not_to be_successfully_executed } end end @@ -78,17 +78,17 @@ Feature: Usage of configuration RSpec.describe 'Run command', :type => :aruba do context 'when fast command' do - before(:each) { run('cli 0') } + before(:each) { run_command('cli 0') } it { expect(last_command_started).to be_successfully_executed } end context 'when slow command and this is known by the developer', :slow_command => true do - before(:each) { run('cli 2') } + before(:each) { run_command('cli 2') } it { expect(last_command_started).to be_successfully_executed } end context 'when slow command, but this might be a failure' do - before(:each) { run('cli 2') } + before(:each) { run_command('cli 2') } it { expect(last_command_started).not_to be_successfully_executed } end end diff --git a/features/hooks/after/command.feature b/features/hooks/after/command.feature index c7341d175..c5b477522 100644 --- a/features/hooks/after/command.feature +++ b/features/hooks/after/command.feature @@ -32,7 +32,7 @@ Feature: After command hooks require 'spec_helper' RSpec.describe 'Hooks', :type => :aruba do - before(:each) { run_simple 'echo running' } + before(:each) { run_command_and_stop 'echo running' } it { expect(last_command_started.stdout.chomp).to eq 'running' } end diff --git a/features/hooks/before/command.feature b/features/hooks/before/command.feature index 202d2fb49..13abcf501 100644 --- a/features/hooks/before/command.feature +++ b/features/hooks/before/command.feature @@ -34,7 +34,7 @@ Feature: before_cmd hooks require 'spec_helper' RSpec.describe 'Hooks', :type => :aruba do - before(:each) { run_simple 'echo running' } + before(:each) { run_command_and_stop 'echo running' } it { expect(last_command_started.stdout.chomp).to eq 'running' } end @@ -62,7 +62,7 @@ Feature: before_cmd hooks require 'spec_helper' RSpec.describe 'Hooks', :type => :aruba do - before(:each) { run_simple 'echo running' } + before(:each) { run_command_and_stop 'echo running' } it { expect(last_command_started.stdout.chomp).to eq 'running' } end diff --git a/features/matchers/timeouts.feature b/features/matchers/timeouts.feature index 012c2c829..bc141d77b 100644 --- a/features/matchers/timeouts.feature +++ b/features/matchers/timeouts.feature @@ -18,7 +18,7 @@ Feature: Check if a timeout occured during command execution RSpec.describe 'Long running command', :type => :aruba do before(:each) { aruba.config.exit_timeout = 0 } - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect(last_command_started).to run_too_long } end @@ -39,7 +39,7 @@ Feature: Check if a timeout occured during command execution RSpec.describe 'Short running command', :type => :aruba do before(:each) { aruba.config.exit_timeout = 5 } - before(:each) { run('cli') } + before(:each) { run_command('cli') } it { expect(last_command_started).to have_finished_in_time } end diff --git a/features/step_definitions/aruba_dev_steps.rb b/features/step_definitions/aruba_dev_steps.rb index e96e4b579..7de37934b 100644 --- a/features/step_definitions/aruba_dev_steps.rb +++ b/features/step_definitions/aruba_dev_steps.rb @@ -51,6 +51,6 @@ end Then(/^aruba should be installed on the local system$/) do - run('gem list aruba') + run_command('gem list aruba') expect(last_command_started).to have_output(/aruba/) end diff --git a/lib/aruba/api/commands.rb b/lib/aruba/api/commands.rb index 309c435bb..c6a086a4b 100644 --- a/lib/aruba/api/commands.rb +++ b/lib/aruba/api/commands.rb @@ -150,7 +150,8 @@ def run_command(*args) startup_wait_time = opts[:startup_wait_time].nil? ? aruba.config.startup_wait_time : opts[:startup_wait_time] else if args.size > 1 - Aruba.platform.deprecated("Please pass options to `#run` as named parameters/hash and don\'t use the old style, e.g. `#run('cmd', :exit_timeout => 5)`.") + Aruba.platform.deprecated( + "Please pass options to `#run_command` as named parameters/hash and don\'t use the old style, e.g. `#run_command('cmd', :exit_timeout => 5)`.") end exit_timeout = args[0].nil? ? aruba.config.exit_timeout : args[0] @@ -254,7 +255,7 @@ def run_command_and_stop(*args) else if args.size > 1 # rubocop:disable Metrics/LineLength - Aruba.platform.deprecated("Please pass options to `#run_simple` as named parameters/hash and don\'t use the old style with positional parameters, NEW: e.g. `#run_simple('cmd', :exit_timeout => 5)`.") + Aruba.platform.deprecated("Please pass options to `#run_command_and_stop` as named parameters/hash and don\'t use the old style with positional parameters, NEW: e.g. `#run_command_and_stop('cmd', :exit_timeout => 5)`.") # rubocop:enable Metrics/LineLength end @@ -268,7 +269,7 @@ def run_command_and_stop(*args) } end - command = run(cmd, opts) + command = run_command(cmd, opts) command.stop if Aruba::VERSION < '1' diff --git a/lib/aruba/api/rvm.rb b/lib/aruba/api/rvm.rb index 50bc40468..7baf145c1 100644 --- a/lib/aruba/api/rvm.rb +++ b/lib/aruba/api/rvm.rb @@ -16,7 +16,7 @@ module Rvm # @param [String] gemset # The name of the gemset to be used def use_clean_gemset(gemset) - run_simple(%{rvm gemset create "#{gemset}"}, true) + run_command_and_stop(%{rvm gemset create "#{gemset}"}, true) if all_stdout =~ /'#{gemset}' gemset created \((.*)\)\./ gem_home = Regexp.last_match[1] set_environment_variable('GEM_HOME', gem_home) @@ -27,7 +27,7 @@ def use_clean_gemset(gemset) paths.unshift(File.join(gem_home, 'bin')) set_environment_variable('PATH', paths.uniq.join(File::PATH_SEPARATOR)) - run_simple("gem install bundler", true) + run_command_and_stop("gem install bundler", true) else raise "I didn't understand rvm's output: #{all_stdout}" end diff --git a/lib/aruba/cucumber/command.rb b/lib/aruba/cucumber/command.rb index 8a7a1a113..64614d7f8 100644 --- a/lib/aruba/cucumber/command.rb +++ b/lib/aruba/cucumber/command.rb @@ -7,26 +7,26 @@ warn(%{\e[35m The /^I run "(.*)"$/ step definition is deprecated. Please use the `backticks` version\e[0m}) cmd = sanitize_text(cmd) - run_simple(cmd, false) + run_command_and_stop(cmd, false) end When(/^I run `([^`]*)`$/)do |cmd| cmd = sanitize_text(cmd) - run_simple(cmd, :fail_on_error => false) + run_command_and_stop(cmd, :fail_on_error => false) end When(/^I successfully run "(.*)"$/)do |cmd| warn(%{\e[35m The /^I successfully run "(.*)"$/ step definition is deprecated. Please use the `backticks` version\e[0m}) cmd = sanitize_text(cmd) - run_simple(cmd) + run_command_and_stop(cmd) end ## I successfully run `echo -n "Hello"` ## I successfully run `sleep 29` for up to 30 seconds When(/^I successfully run `(.*?)`(?: for up to (\d+) seconds)?$/)do |cmd, secs| cmd = sanitize_text(cmd) - run_simple(cmd, :fail_on_error => true, :exit_timeout => secs && secs.to_i) + run_command_and_stop(cmd, :fail_on_error => true, :exit_timeout => secs && secs.to_i) end When(/^I run the following (?:commands|script)(?: (?:with|in) `([^`]+)`)?:$/) do |shell, commands| @@ -48,12 +48,12 @@ When(/^I run `([^`]*)` interactively$/)do |cmd| cmd = sanitize_text(cmd) - @interactive = run(cmd) + @interactive = run_command(cmd) end # Merge interactive and background after refactoring with event queue When(/^I run `([^`]*)` in background$/)do |cmd| - run(sanitize_text(cmd)) + run_command(sanitize_text(cmd)) end When(/^I type "([^"]*)"$/) do |input| diff --git a/spec/aruba/api_spec.rb b/spec/aruba/api_spec.rb index 7129023ae..281055185 100644 --- a/spec/aruba/api_spec.rb +++ b/spec/aruba/api_spec.rb @@ -864,7 +864,7 @@ def actual_permissions end it "should announce to stdout exactly once" do - @aruba.run_simple('echo "hello world"', false) + @aruba.run_command_and_stop('echo "hello world"', false) expect(@aruba.last_command_started.output).to include('hello world') end end @@ -872,7 +872,7 @@ def actual_permissions context 'disabled' do it "should not announce to stdout" do result = capture(:stdout) do - @aruba.run_simple('echo "hello world"', false) + @aruba.run_command_and_stop('echo "hello world"', false) end expect(result).not_to include('hello world') @@ -882,8 +882,8 @@ def actual_permissions end end - describe '#run' do - before(:each){ @aruba.run 'cat' } + describe '#run_command' do + before(:each){ @aruba.run_command 'cat' } after(:each) { @aruba.all_commands.each(&:stop) } it "respond to input" do @@ -927,7 +927,7 @@ def root_directory it "set environment variable" do @aruba.set_environment_variable 'LONG_LONG_ENV_VARIABLE', 'true' - @aruba.run_simple "env" + @aruba.run_command_and_stop "env" expect(@aruba.last_command_started.output). to include("LONG_LONG_ENV_VARIABLE=true") end @@ -935,7 +935,7 @@ def root_directory it "overwrites environment variable" do @aruba.set_environment_variable 'LONG_LONG_ENV_VARIABLE', 'true' @aruba.set_environment_variable 'LONG_LONG_ENV_VARIABLE', 'false' - @aruba.run_simple "env" + @aruba.run_command_and_stop "env" expect(@aruba.last_command_started.output). to include("LONG_LONG_ENV_VARIABLE=false") end diff --git a/spec/aruba/matchers/command_spec.rb b/spec/aruba/matchers/command_spec.rb index 39300fdbd..383c02087 100644 --- a/spec/aruba/matchers/command_spec.rb +++ b/spec/aruba/matchers/command_spec.rb @@ -14,7 +14,7 @@ def announcer(*args) describe '#to_have_exit_status' do let(:cmd) { 'true' } - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } context 'when has exit 0' do it { expect(last_command_started).to have_exit_status 0 } @@ -29,7 +29,7 @@ def announcer(*args) describe '#to_be_successfully_executed_' do let(:cmd) { 'true' } - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } context 'when has exit 0' do it { expect(last_command_started).to be_successfully_executed } @@ -46,15 +46,15 @@ def announcer(*args) let(:output) { 'hello world' } context 'when have output hello world on stdout' do - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } it { expect(last_command_started).to have_output output } end context 'when multiple commands output hello world on stdout' do context 'and all comands must have the output' do before(:each) do - run(cmd) - run(cmd) + run_command(cmd) + run_command(cmd) end it { expect(all_commands).to all have_output output } @@ -62,8 +62,8 @@ def announcer(*args) context 'and any comand can have the output' do before(:each) do - run(cmd) - run('echo hello universe') + run_command(cmd) + run_command('echo hello universe') end it { expect(all_commands).to include have_output(output) } @@ -86,13 +86,13 @@ def announcer(*args) let(:cmd) { "cmd.sh #{output}" } - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } it { expect(last_command_started).to have_output output } end context 'when not has output' do - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } it { expect(last_command_started).not_to have_output 'hello universe' } end @@ -103,7 +103,7 @@ def announcer(*args) let(:output) { 'hello world' } context 'when have output hello world on stdout' do - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } it { expect(last_command_started).to have_output_on_stdout output } end @@ -123,13 +123,13 @@ def announcer(*args) let(:cmd) { "cmd.sh #{output}" } - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } it { expect(last_command_started).not_to have_output_on_stdout output } end context 'when not has output' do - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } it { expect(last_command_started).not_to have_output_on_stdout 'hello universe' } end @@ -140,7 +140,7 @@ def announcer(*args) let(:output) { 'hello world' } context 'when have output hello world on stdout' do - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } it { expect(last_command_started).not_to have_output_on_stderr output } end @@ -160,13 +160,13 @@ def announcer(*args) let(:cmd) { "cmd.sh #{output}" } - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } it { expect(last_command_started).to have_output_on_stderr output } end context 'when not has output' do - before(:each) { run(cmd) } + before(:each) { run_command(cmd) } it { expect(last_command_started).not_to have_output_on_stderr 'hello universe' } end