[DRE-commits] [ruby-aruba] 20/74: Move feature tests to correct file
Hideki Yamane
henrich at moszumanska.debian.org
Sat Nov 28 01:16:31 UTC 2015
This is an automated email from the git hooks/post-receive script.
henrich pushed a commit to branch debian/sid
in repository ruby-aruba.
commit adcd0e97ceee6c5b3b3555e8d53559c89ac5840e
Author: Dennis Günnewig <dg1 at ratiodata.de>
Date: Tue Nov 24 10:23:29 2015 +0100
Move feature tests to correct file
---
features/api/command/run.feature | 70 ----------------------
features/api/command/{run.feature => stop.feature} | 55 ++++++-----------
2 files changed, 18 insertions(+), 107 deletions(-)
diff --git a/features/api/command/run.feature b/features/api/command/run.feature
index 949d969..d03bc92 100644
--- a/features/api/command/run.feature
+++ b/features/api/command/run.feature
@@ -53,73 +53,3 @@ Feature: Run command
"""
When I run `rspec`
Then the specs should all pass
-
- Scenario: Stop successful command with configured signal
- Given an executable named "bin/cli" with:
- """bash
- #!/bin/bash
- function usr1 {
- echo "Exit..."
- exit 0
- }
-
- function term {
- echo "No! No exit here. Try USR1. I stop the command with exit 1."
- exit 1
- }
-
- trap usr1 USR1
- trap term TERM
- while [ true ]; do sleep 1; done
- """
- And a file named "spec/run_spec.rb" with:
- """ruby
- require 'spec_helper'
-
- Aruba.configure do |config|
- config.stop_signal = 'USR1'
- config.exit_timeout = 1
- end
-
- RSpec.describe 'Run command', :type => :aruba do
- before(:each) { run('cli') }
- it { expect(last_command_started).to be_successfully_executed }
- end
- """
- When I run `rspec`
- Then the specs should all pass
-
- Scenario: Stop unsuccessful command with configured signal
- Given an executable named "bin/cli" with:
- """bash
- #!/bin/bash
- function usr1 {
- echo "Exit..."
- exit 2
- }
-
- function term {
- echo "No! No exit here. Try USR1. I stop the command with exit 1."
- exit 1
- }
-
- trap usr1 USR1
- trap term TERM
- while [ true ]; do sleep 1; done
- """
- And a file named "spec/run_spec.rb" with:
- """ruby
- require 'spec_helper'
-
- Aruba.configure do |config|
- config.stop_signal = 'USR1'
- config.exit_timeout = 1
- end
-
- RSpec.describe 'Run command', :type => :aruba do
- before(:each) { run('cli') }
- it { expect(last_command_started).to have_exit_status 2 }
- end
- """
- When I run `rspec`
- Then the specs should all pass
diff --git a/features/api/command/run.feature b/features/api/command/stop.feature
similarity index 61%
copy from features/api/command/run.feature
copy to features/api/command/stop.feature
index 949d969..6cfdaa7 100644
--- a/features/api/command/run.feature
+++ b/features/api/command/stop.feature
@@ -1,54 +1,35 @@
-Feature: Run command
+Feature: Stop command
- To run a command use the `#run`-method.
+ To stop commands via API you can do the following:
+
+ - `last_command_started.stop`
+ - `stop_all_commands`
Background:
Given I use a fixture named "cli-app"
- Scenario: Existing executable
+ Scenario: Stop all commands
Given an executable named "bin/cli" with:
- """bash
- #!/bin/bash
- exit 0
"""
- And a file named "spec/run_spec.rb" with:
- """ruby
- require 'spec_helper'
+ #!/bin/bash
+ function term {
+ exit 0
+ }
- RSpec.describe 'Run command', :type => :aruba do
- before(:each) { run('cli') }
- it { expect(last_command_started).to be_successfully_executed }
- end
- """
- When I run `rspec`
- Then the specs should all pass
+ trap term TERM
- Scenario: Relative path to executable
- Given an executable named "bin/cli" with:
- """bash
- #!/bin/bash
- exit 0
+ while [ true ]; do sleep 1; done
+ """
+ And a file named "spec/sanitize_spec.rb" with:
"""
- And a file named "spec/run_spec.rb" with:
- """ruby
require 'spec_helper'
- RSpec.describe 'Run command', :type => :aruba do
- before(:each) { run('bin/cli') }
- it { expect(last_command_started).to be_successfully_executed }
- end
- """
- When I run `rspec`
- Then the specs should all pass
+ RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 3, :startup_wait_time => 2 do
+ before(:each) { 3.times { run('cli') } }
- Scenario: Non-existing executable
- Given a file named "bin/cli" does not exist
- And a file named "spec/run_spec.rb" with:
- """ruby
- require 'spec_helper'
+ before(:each) { stop_all_commands }
- 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(all_commands).to all be_successfully_executed }
end
"""
When I run `rspec`
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-aruba.git
More information about the Pkg-ruby-extras-commits
mailing list