Skip to content

Commit

Permalink
Merge pull request #438 from cucumber/feature/rename-command-runners
Browse files Browse the repository at this point in the history
Rename methods which run commands
  • Loading branch information
maxmeyer authored Jun 29, 2017
2 parents dee8b4a + 4b94acc commit 292ef4c
Show file tree
Hide file tree
Showing 33 changed files with 165 additions and 165 deletions.
10 changes: 5 additions & 5 deletions features/02_configure_aruba/basics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ Feature: Usage of configuration
RSpec.describe 'Run command', :type => :aruba do
context 'when fast command' do
before(:each) { run('aruba-test-cli 0') }
before(:each) { run_command('aruba-test-cli 0') }
it { expect(last_command_started).to be_successfully_executed }
end
context 'when slow command' do
before(:each) { run('aruba-test-cli 2') }
before(:each) { run_command('aruba-test-cli 2') }
it { expect(last_command_started).not_to be_successfully_executed }
end
end
Expand Down Expand Up @@ -78,17 +78,17 @@ Feature: Usage of configuration
RSpec.describe 'Run command', :type => :aruba do
context 'when fast command' do
before(:each) { run('aruba-test-cli 0') }
before(:each) { run_command('aruba-test-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('aruba-test-cli 2') }
before(:each) { run_command('aruba-test-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('aruba-test-cli 2') }
before(:each) { run_command('aruba-test-cli 2') }
it { expect(last_command_started).not_to be_successfully_executed }
end
end
Expand Down
10 changes: 5 additions & 5 deletions features/02_configure_aruba/command_runtime_environment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand All @@ -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' }
Expand All @@ -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' }
Expand All @@ -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' }
Expand All @@ -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' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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
Expand Down Expand Up @@ -64,7 +64,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
Expand Down
10 changes: 5 additions & 5 deletions features/04_aruba_api/command/find_a_started_command.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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 }
Expand All @@ -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"') }
Expand Down
4 changes: 2 additions & 2 deletions features/04_aruba_api/command/read_stderr_of_command.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: Access STDERR of command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run('aruba-test-cli') }
before(:each) { run_command('aruba-test-cli') }
before(:each) { stop_all_commands }
it { expect(last_command_started.stderr).to start_with 'Hello' }
end
Expand All @@ -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('aruba-test-cli') }
before(:each) { run_command('aruba-test-cli') }
it { expect(last_command_started.stderr).to start_with 'Hello' }
end
"""
Expand Down
4 changes: 2 additions & 2 deletions features/04_aruba_api/command/read_stdout_of_command.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Feature: Access STDOUT of command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run('aruba-test-cli') }
before(:each) { run_command('aruba-test-cli') }
before(:each) { stop_all_commands }
it { expect(last_command_started.stdout).to start_with 'Hello' }
end
Expand All @@ -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('aruba-test-cli') }
before(:each) { run_command('aruba-test-cli') }
it { expect(last_command_started.stdout).to start_with 'Hello' }
end
"""
Expand Down
34 changes: 17 additions & 17 deletions features/04_aruba_api/command/run_command.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Feature: Run command
- `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`:

Expand All @@ -34,7 +34,7 @@ Feature: Run command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run('aruba-test-cli') }
before(:each) { run_command('aruba-test-cli') }
it { expect(last_command_started).to be_successfully_executed }
end
"""
Expand All @@ -52,7 +52,7 @@ Feature: Run command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run('bin/aruba-test-cli') }
before(:each) { run_command('bin/aruba-test-cli') }
it { expect(last_command_started).to be_successfully_executed }
end
"""
Expand All @@ -66,7 +66,7 @@ Feature: Run command
require 'spec_helper'
RSpec.describe 'Find path for command', :type => :aruba do
it { expect { run('aruba-test-cli') }.to raise_error Aruba::LaunchError, /Command "aruba-test-cli" not found in PATH-variable/ }
it { expect { run_command('aruba-test-cli') }.to raise_error Aruba::LaunchError, /Command "aruba-test-cli" not found in PATH-variable/ }
end
"""
When I run `rspec`
Expand Down Expand Up @@ -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('aruba-test-cli') }
before(:each) { run_command('aruba-test-cli') }
before(:each) { last_command_started.send_signal 'HUP' }
it { expect(last_command_started).to be_successfully_executed }
Expand Down Expand Up @@ -145,7 +145,7 @@ Feature: Run command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3 do
before(:each) { run('aruba-test-cli') }
before(:each) { run_command('aruba-test-cli') }
it { expect(last_command_started).to be_successfully_executed }
it { expect(last_command_started).to have_output /Hello, Aruba here/ }
Expand Down Expand Up @@ -220,8 +220,8 @@ Feature: Run command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1 do
before(:each) { run('aruba-test-cli1', 3, 0.1, 'TERM', 2) }
before(:each) { run('aruba-test-cli2', 3, 0.1, 'TERM', 1) }
before(:each) { run_command('aruba-test-cli1', 3, 0.1, 'TERM', 2) }
before(:each) { run_command('aruba-test-cli2', 3, 0.1, 'TERM', 1) }
before(:each) { last_command_started.send_signal 'HUP' }
it { expect(last_command_started).to be_successfully_executed }
Expand Down Expand Up @@ -298,8 +298,8 @@ Feature: Run command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1 do
before(:each) { run('aruba-test-cli1', :startup_wait_time => 2) }
before(:each) { run('aruba-test-cli2', :startup_wait_time => 1) }
before(:each) { run_command('aruba-test-cli1', :startup_wait_time => 2) }
before(:each) { run_command('aruba-test-cli2', :startup_wait_time => 1) }
before(:each) { last_command_started.send_signal 'HUP' }
it { expect(last_command_started).to be_successfully_executed }
Expand Down Expand Up @@ -342,8 +342,8 @@ Feature: Run command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run('aruba-test-cli1', 3) }
before(:each) { run('aruba-test-cli2', 1) }
before(:each) { run_command('aruba-test-cli1', 3) }
before(:each) { run_command('aruba-test-cli2', 1) }
it { expect(last_command_started).to be_successfully_executed }
it { expect(last_command_started).to have_output /Hello, Aruba here/ }
Expand Down Expand Up @@ -383,8 +383,8 @@ Feature: Run command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run('aruba-test-cli1', :exit_timeout => 3) }
before(:each) { run('aruba-test-cli2', :exit_timeout => 1) }
before(:each) { run_command('aruba-test-cli1', :exit_timeout => 3) }
before(:each) { run_command('aruba-test-cli2', :exit_timeout => 1) }
it { expect(last_command_started).to be_successfully_executed }
it { expect(last_command_started).to have_output /Hello, Aruba here/ }
Expand All @@ -404,7 +404,7 @@ Feature: Run command
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run('aruba-test-cli') }
before(:each) { run_command('aruba-test-cli') }
let!(:found_command) { find_command('aruba-test-cli') }
it { expect { found_command.start }.to raise_error Aruba::CommandAlreadyStartedError }
end
Expand Down
24 changes: 12 additions & 12 deletions features/04_aruba_api/command/run_simple.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: Run command in a simpler fashion

To run a command use the `#run_simple`-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`:
Expand All @@ -23,7 +23,7 @@ Feature: Run command in a simpler fashion
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
it { expect { run_simple('aruba-test-cli') }.to raise_error RSpec::Expectations::ExpectationNotMetError }
it { expect { run_command_and_stop('aruba-test-cli') }.to raise_error RSpec::Expectations::ExpectationNotMetError }
end
"""
When I run `rspec`
Expand All @@ -40,7 +40,7 @@ Feature: Run command in a simpler fashion
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
it { expect { run_simple('aruba-test-cli', :fail_on_error => true) }.to raise_error }
it { expect { run_command_and_stop('aruba-test-cli', :fail_on_error => true) }.to raise_error }
end
"""
When I run `rspec`
Expand All @@ -57,7 +57,7 @@ Feature: Run command in a simpler fashion
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
it { expect { run_simple('aruba-test-cli', true) }.to raise_error }
it { expect { run_command_and_stop('aruba-test-cli', true) }.to raise_error }
end
"""
When I run `rspec`
Expand All @@ -74,7 +74,7 @@ Feature: Run command in a simpler fashion
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
it { expect { run_simple('aruba-test-cli', :fail_on_error => false) }.not_to raise_error }
it { expect { run_command_and_stop('aruba-test-cli', :fail_on_error => false) }.not_to raise_error }
end
"""
When I run `rspec`
Expand All @@ -91,7 +91,7 @@ Feature: Run command in a simpler fashion
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
it { expect { run_simple('aruba-test-cli', false) }.not_to raise_error }
it { expect { run_command_and_stop('aruba-test-cli', false) }.not_to raise_error }
end
"""
When I run `rspec`
Expand Down Expand Up @@ -126,7 +126,7 @@ Feature: Run command in a simpler fashion
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 2 do
before(:each) { run_simple('aruba-test-cli') }
before(:each) { run_command_and_stop('aruba-test-cli') }
it { expect(last_command_started).to be_successfully_executed }
it { expect(last_command_started).to have_output /Hello, Aruba is working/ }
Expand Down Expand Up @@ -156,7 +156,7 @@ Feature: Run command in a simpler fashion
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3 do
before(:each) { run_simple('aruba-test-cli') }
before(:each) { run_command_and_stop('aruba-test-cli') }
it { expect(last_command_started).to be_successfully_executed }
it { expect(last_command_started).to have_output /Hello, Aruba here/ }
Expand All @@ -165,10 +165,10 @@ Feature: Run command in a simpler fashion
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/aruba-test-cli" with:
Expand Down Expand Up @@ -199,7 +199,7 @@ Feature: Run command in a simpler fashion
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 2, :startup_wait_time => 1 do
before(:each) { run_simple('aruba-test-cli') }
before(:each) { run_command_and_stop('aruba-test-cli') }
it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError }
end
"""
Expand All @@ -224,7 +224,7 @@ Feature: Run command in a simpler fashion
end
RSpec.describe 'Run command', :type => :aruba do
it { expect { run_simple('aruba-test-cli', :fail_on_error => true) }.to_not raise_error }
it { expect { run_command_and_stop('aruba-test-cli', :fail_on_error => true) }.to_not raise_error }
end
"""
When I run `rspec`
Expand Down
Loading

0 comments on commit 292ef4c

Please sign in to comment.