aruba 0.7.4 → 0.8.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.nav +12 -0
- data/.rspec +1 -0
- data/.rubocop.yml +12 -0
- data/.simplecov +2 -0
- data/.travis.yml +5 -6
- data/Gemfile +53 -26
- data/History.md +17 -0
- data/LICENSE +1 -1
- data/README.md +45 -19
- data/Rakefile +12 -2
- data/TODO.md +3 -0
- data/aruba.gemspec +19 -8
- data/cucumber.yml +1 -1
- data/features/api/cd.feature +119 -0
- data/features/api/command/run.feature +37 -0
- data/features/api/command/which.feature +37 -0
- data/features/api/environment/append_environment_variable.feature +118 -0
- data/features/api/environment/prepend_environment_variable.feature +118 -0
- data/features/api/environment/set_environment_variable.feature +252 -0
- data/features/configuration/exit_timeout.feature +51 -0
- data/features/configuration/fixtures_directories.feature +31 -0
- data/features/configuration/fixtures_path_prefix.feature +24 -0
- data/features/configuration/io_timeout.feature +31 -0
- data/features/configuration/keep_ansi.feature +31 -0
- data/features/configuration/root_directory.feature +31 -0
- data/features/configuration/working_directory.feature +32 -0
- data/features/fixtures/cli-app/.gitignore +9 -0
- data/features/fixtures/cli-app/.rspec +2 -0
- data/features/fixtures/cli-app/README.md +34 -0
- data/features/fixtures/cli-app/Rakefile +1 -0
- data/features/fixtures/cli-app/bin/cli +6 -0
- data/features/fixtures/cli-app/cli-app.gemspec +26 -0
- data/features/fixtures/cli-app/features/support/env.rb +1 -0
- data/features/fixtures/cli-app/lib/cli/app.rb +13 -0
- data/features/fixtures/cli-app/lib/cli/app/version.rb +5 -0
- data/features/fixtures/cli-app/script/console +14 -0
- data/features/fixtures/cli-app/spec/cli/app_spec.rb +7 -0
- data/features/fixtures/cli-app/spec/spec_helper.rb +10 -0
- data/features/fixtures/copy/file.txt +1 -1
- data/features/hooks/after/command.feature +34 -0
- data/features/hooks/before/command.feature +61 -0
- data/features/matchers/directory/have_sub_directory.feature +110 -0
- data/features/matchers/file/be_existing_file.feature +82 -0
- data/features/matchers/file/have_file_content.feature +123 -0
- data/features/matchers/file/have_file_size.feature +107 -0
- data/features/matchers/path/be_an_absolute_path.feature +74 -0
- data/features/matchers/path/be_an_existing_path.feature +97 -0
- data/features/matchers/path/have_permissions.feature +118 -0
- data/features/matchers/timeouts.feature +48 -0
- data/features/step_definitions/aruba_dev_steps.rb +69 -1
- data/features/steps/commands/exit_statuses.feature +136 -0
- data/features/steps/commands/in_process.feature +129 -0
- data/features/steps/commands/run.feature +36 -0
- data/features/steps/environment/home_variable.feature +49 -0
- data/features/steps/environment/set_environment_variable.feature +34 -0
- data/features/support/aruba.rb +5 -0
- data/features/support/env.rb +8 -4
- data/lib/aruba.rb +20 -8
- data/lib/aruba/announcer.rb +1 -0
- data/lib/aruba/api.rb +18 -1179
- data/lib/aruba/api/command.rb +351 -0
- data/lib/aruba/api/core.rb +141 -0
- data/lib/aruba/api/deprecated.rb +549 -0
- data/lib/aruba/api/environment.rb +61 -0
- data/lib/aruba/api/filesystem.rb +305 -0
- data/lib/aruba/api/rvm.rb +39 -0
- data/lib/aruba/aruba_path.rb +75 -0
- data/lib/aruba/basic_configuration.rb +208 -0
- data/lib/aruba/basic_configuration/option.rb +25 -0
- data/lib/aruba/config.rb +43 -30
- data/lib/aruba/config/jruby.rb +14 -0
- data/lib/aruba/config_wrapper.rb +17 -0
- data/lib/aruba/contracts/relative_path.rb +13 -0
- data/lib/aruba/creators/aruba_file_creator.rb +32 -0
- data/lib/aruba/creators/aruba_fixed_size_file_creator.rb +32 -0
- data/lib/aruba/cucumber.rb +87 -53
- data/lib/aruba/cucumber/hooks.rb +65 -10
- data/lib/aruba/environment.rb +121 -0
- data/lib/aruba/errors.rb +3 -0
- data/lib/aruba/extensions/string/strip.rb +24 -0
- data/lib/aruba/hooks.rb +54 -0
- data/lib/aruba/jruby.rb +4 -9
- data/lib/aruba/matchers/command.rb +1 -79
- data/lib/aruba/matchers/command/be_successfully_executed.rb +30 -0
- data/lib/aruba/matchers/command/have_exit_status.rb +47 -0
- data/lib/aruba/matchers/command/have_finished_in_time.rb +42 -0
- data/lib/aruba/matchers/directory.rb +1 -59
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +34 -0
- data/lib/aruba/matchers/directory/have_sub_directory.rb +49 -0
- data/lib/aruba/matchers/file.rb +1 -177
- data/lib/aruba/matchers/file/be_an_existing_file.rb +34 -0
- data/lib/aruba/matchers/file/have_file_content.rb +58 -0
- data/lib/aruba/matchers/file/have_file_size.rb +43 -0
- data/lib/aruba/matchers/file/have_same_file_content.rb +44 -0
- data/lib/aruba/matchers/path.rb +1 -99
- data/lib/aruba/matchers/path/a_path_matching_pattern.rb +21 -0
- data/lib/aruba/matchers/path/be_an_absolute_path.rb +32 -0
- data/lib/aruba/matchers/path/be_an_existing_path.rb +33 -0
- data/lib/aruba/matchers/path/have_permissions.rb +60 -0
- data/lib/aruba/matchers/path/match_path_pattern.rb +41 -0
- data/lib/aruba/matchers/rspec.rb +0 -0
- data/lib/aruba/matchers/rspec_matcher_include_regexp.rb +1 -1
- data/lib/aruba/platform.rb +230 -0
- data/lib/aruba/process_monitor.rb +23 -5
- data/lib/aruba/processes/basic_process.rb +35 -1
- data/lib/aruba/processes/debug_process.rb +26 -15
- data/lib/aruba/processes/in_process.rb +21 -9
- data/lib/aruba/processes/spawn_process.rb +29 -19
- data/lib/aruba/reporting.rb +2 -0
- data/lib/aruba/rspec.rb +61 -13
- data/lib/aruba/runtime.rb +33 -0
- data/script/bootstrap +4 -6
- data/spec/aruba/api/runtime_spec.rb +28 -0
- data/spec/aruba/api_spec.rb +129 -126
- data/spec/aruba/aruba_path_spec.rb +65 -0
- data/spec/aruba/basic_configuration_spec.rb +5 -0
- data/spec/aruba/config_wrapper_spec.rb +25 -0
- data/spec/aruba/configuration_spec.rb +5 -0
- data/spec/aruba/jruby_spec.rb +34 -18
- data/spec/aruba/matchers/directory_spec.rb +6 -7
- data/spec/aruba/matchers/file_spec.rb +16 -20
- data/spec/aruba/matchers/path_spec.rb +14 -11
- data/spec/aruba/rspec_spec.rb +15 -0
- data/spec/aruba/runtime_spec.rb +29 -0
- data/spec/aruba/spawn_process_spec.rb +2 -2
- data/spec/spec_helper.rb +10 -2
- data/spec/support/configs/rspec.rb +1 -1
- data/spec/support/matchers/option.rb +35 -0
- data/spec/support/shared_contexts/aruba.rb +10 -8
- data/spec/support/shared_examples/configuration.rb +116 -0
- metadata +182 -33
- data/.rvmrc +0 -1
- data/features/before_cmd_hooks.feature +0 -61
- data/features/command_environment_variables.feature +0 -31
- data/features/custom_ruby_process.feature +0 -12
- data/features/exit_statuses.feature +0 -30
- data/features/support/custom_main.rb +0 -28
- data/lib/aruba/matchers/mode.rb +0 -52
- data/lib/aruba/utils.rb +0 -21
@@ -0,0 +1,97 @@
|
|
1
|
+
Feature: Check if path exists
|
2
|
+
|
3
|
+
If you need to check if a given path exists, you can use the
|
4
|
+
`be_an_existing_path`-matcher. It doesn't care if the path is a directory or
|
5
|
+
a path.
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
require 'spec_helper'
|
9
|
+
|
10
|
+
RSpec.describe 'Check if path exists', :type => :aruba do
|
11
|
+
let(:path) { 'file.txt' }
|
12
|
+
before(:each) { touch(path) }
|
13
|
+
|
14
|
+
it { expect(path).to be_an_existing_path }
|
15
|
+
end
|
16
|
+
```
|
17
|
+
|
18
|
+
Background:
|
19
|
+
Given I use a fixture named "cli-app"
|
20
|
+
|
21
|
+
Scenario: Expect single existing path
|
22
|
+
Given a file named "spec/existing_path_spec.rb" with:
|
23
|
+
"""
|
24
|
+
require 'spec_helper'
|
25
|
+
|
26
|
+
RSpec.describe 'Check if path exists', :type => :aruba do
|
27
|
+
let(:path) { 'file.txt' }
|
28
|
+
before(:each) { touch(path) }
|
29
|
+
it { expect(path).to be_an_existing_path }
|
30
|
+
end
|
31
|
+
"""
|
32
|
+
When I run `rspec`
|
33
|
+
Then the specs should all pass
|
34
|
+
|
35
|
+
Scenario: Expect single existing directory
|
36
|
+
Given a file named "spec/existing_path_spec.rb" with:
|
37
|
+
"""
|
38
|
+
require 'spec_helper'
|
39
|
+
|
40
|
+
RSpec.describe 'Check if path exists', :type => :aruba do
|
41
|
+
let(:path) { 'dir.d' }
|
42
|
+
before(:each) { create_directory(path) }
|
43
|
+
it { expect(path).to be_an_existing_path }
|
44
|
+
end
|
45
|
+
"""
|
46
|
+
When I run `rspec`
|
47
|
+
Then the specs should all pass
|
48
|
+
|
49
|
+
Scenario: Expect single non-existing path
|
50
|
+
Given a file named "spec/existing_path_spec.rb" with:
|
51
|
+
"""
|
52
|
+
require 'spec_helper'
|
53
|
+
|
54
|
+
RSpec.describe 'Check if path exists', :type => :aruba do
|
55
|
+
let(:path) { 'file.txt' }
|
56
|
+
it { expect(path).not_to be_an_existing_path }
|
57
|
+
end
|
58
|
+
"""
|
59
|
+
When I run `rspec`
|
60
|
+
Then the specs should all pass
|
61
|
+
|
62
|
+
Scenario: Expect multiple existing paths
|
63
|
+
Given a file named "spec/existing_path_spec.rb" with:
|
64
|
+
"""
|
65
|
+
require 'spec_helper'
|
66
|
+
|
67
|
+
RSpec.describe 'Check if path exists', :type => :aruba do
|
68
|
+
let(:paths) { %w(path1.txt path2.txt) }
|
69
|
+
|
70
|
+
before :each do
|
71
|
+
paths.each { |f| touch(f) }
|
72
|
+
end
|
73
|
+
|
74
|
+
it { expect(paths).to all be_an_existing_path }
|
75
|
+
end
|
76
|
+
"""
|
77
|
+
When I run `rspec`
|
78
|
+
Then the specs should all pass
|
79
|
+
|
80
|
+
Scenario: Expect a least one existing path
|
81
|
+
Given a file named "spec/existing_path_spec.rb" with:
|
82
|
+
"""
|
83
|
+
require 'spec_helper'
|
84
|
+
|
85
|
+
RSpec.describe 'Check if path exists', :type => :aruba do
|
86
|
+
let(:paths) { %w(path1.txt path2.txt) }
|
87
|
+
|
88
|
+
before :each do
|
89
|
+
touch(paths.first)
|
90
|
+
end
|
91
|
+
|
92
|
+
it { expect(paths).to include an_existing_path }
|
93
|
+
end
|
94
|
+
"""
|
95
|
+
When I run `rspec`
|
96
|
+
Then the specs should all pass
|
97
|
+
|
@@ -0,0 +1,118 @@
|
|
1
|
+
Feature: Check if path has permissions in filesystem
|
2
|
+
|
3
|
+
If you need to check if a given path has some permissions in filesystem, you
|
4
|
+
can use the `have_permissions`-matcher. It fails if the file or directory
|
5
|
+
does not exist. You need to pass it the permissions either as `Octal`
|
6
|
+
(`0700`) or `String` (`'0700'`).
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
require 'spec_helper'
|
10
|
+
|
11
|
+
RSpec.describe 'Check if path has permissions', :type => :aruba do
|
12
|
+
context 'when is file' do
|
13
|
+
let(:file) { 'file.txt' }
|
14
|
+
let(:permissions) { 0700 }
|
15
|
+
|
16
|
+
before(:each) { touch(file) }
|
17
|
+
before(:each) { chmod(permissions, file }
|
18
|
+
|
19
|
+
it { expect(file).to have_permissions permissions }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
Background:
|
25
|
+
Given I use a fixture named "cli-app"
|
26
|
+
|
27
|
+
Scenario: Expect file with permissions
|
28
|
+
Given a file named "spec/path_with_permissions_spec.rb" with:
|
29
|
+
"""
|
30
|
+
require 'spec_helper'
|
31
|
+
|
32
|
+
RSpec.describe 'Check if path has permissions', :type => :aruba do
|
33
|
+
let(:file) { 'file.txt' }
|
34
|
+
let(:permissions) { 0700 }
|
35
|
+
|
36
|
+
before(:each) { touch(file) }
|
37
|
+
before(:each) { chmod(permissions, file) }
|
38
|
+
|
39
|
+
it { expect(file).to have_permissions permissions }
|
40
|
+
end
|
41
|
+
"""
|
42
|
+
When I run `rspec`
|
43
|
+
Then the specs should all pass
|
44
|
+
|
45
|
+
Scenario: Expect directory with permissions
|
46
|
+
Given a file named "spec/path_with_permissions_spec.rb" with:
|
47
|
+
"""
|
48
|
+
require 'spec_helper'
|
49
|
+
|
50
|
+
RSpec.describe 'Check if path has permissions', :type => :aruba do
|
51
|
+
let(:directory) { 'directory.d' }
|
52
|
+
let(:permissions) { 0700 }
|
53
|
+
|
54
|
+
before(:each) { create_directory(directory) }
|
55
|
+
before(:each) { chmod(permissions, directory) }
|
56
|
+
|
57
|
+
it { expect(directory).to have_permissions permissions }
|
58
|
+
end
|
59
|
+
"""
|
60
|
+
When I run `rspec`
|
61
|
+
Then the specs should all pass
|
62
|
+
|
63
|
+
Scenario: Expect multiple files with given permissions
|
64
|
+
Given a file named "spec/path_with_permissions_spec.rb" with:
|
65
|
+
"""
|
66
|
+
require 'spec_helper'
|
67
|
+
|
68
|
+
RSpec.describe 'Check if path has permissions', :type => :aruba do
|
69
|
+
let(:files) { %w(file1.txt file2.txt) }
|
70
|
+
let(:permissions) { 0700 }
|
71
|
+
|
72
|
+
before :each do
|
73
|
+
files.each do |f|
|
74
|
+
touch(f)
|
75
|
+
chmod(permissions, f)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it { expect(files).to all have_permissions permissions }
|
80
|
+
end
|
81
|
+
"""
|
82
|
+
When I run `rspec`
|
83
|
+
Then the specs should all pass
|
84
|
+
|
85
|
+
Scenario: Expect a least one file with permissions
|
86
|
+
Given a file named "spec/path_with_permissions_spec.rb" with:
|
87
|
+
"""
|
88
|
+
require 'spec_helper'
|
89
|
+
|
90
|
+
RSpec.describe 'Check if path has permissions', :type => :aruba do
|
91
|
+
let(:files) { %w(file1.txt file2.txt) }
|
92
|
+
let(:permissions) { 0700 }
|
93
|
+
|
94
|
+
before :each do
|
95
|
+
touch(files.first)
|
96
|
+
chmod(permissions, files.first)
|
97
|
+
end
|
98
|
+
|
99
|
+
it { expect(files).to include a_path_having_permissions permissions }
|
100
|
+
end
|
101
|
+
"""
|
102
|
+
When I run `rspec`
|
103
|
+
Then the specs should all pass
|
104
|
+
|
105
|
+
Scenario: Fails if path does not exist
|
106
|
+
Given a file named "spec/path_with_permissions_spec.rb" with:
|
107
|
+
"""
|
108
|
+
require 'spec_helper'
|
109
|
+
|
110
|
+
RSpec.describe 'Check if path has permissions', :type => :aruba do
|
111
|
+
let(:path) { 'file.txt' }
|
112
|
+
let(:permissions) { 0777 }
|
113
|
+
|
114
|
+
it { expect(path).to have_permissions permissions }
|
115
|
+
end
|
116
|
+
"""
|
117
|
+
When I run `rspec`
|
118
|
+
Then the specs should not all pass
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Feature: Check if a timeout occured during command execution
|
2
|
+
|
3
|
+
If you want to check if a command takes to long to finish it's work
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I use a fixture named "cli-app"
|
7
|
+
|
8
|
+
Scenario: Check if command runs to long
|
9
|
+
Given an executable named "bin/cli" with:
|
10
|
+
"""
|
11
|
+
#!/bin/bash
|
12
|
+
sleep 1
|
13
|
+
"""
|
14
|
+
And a file named "spec/timeout_spec.rb" with:
|
15
|
+
"""
|
16
|
+
require 'spec_helper'
|
17
|
+
|
18
|
+
RSpec.describe 'Long running command', :type => :aruba do
|
19
|
+
before(:each) { aruba.config.exit_timeout = 0 }
|
20
|
+
|
21
|
+
before(:each) { run('cli') }
|
22
|
+
|
23
|
+
it { expect(last_command).to run_too_long }
|
24
|
+
end
|
25
|
+
"""
|
26
|
+
When I run `rspec`
|
27
|
+
Then the specs should all pass
|
28
|
+
|
29
|
+
Scenario: Check if command finishes in time
|
30
|
+
Given an executable named "bin/cli" with:
|
31
|
+
"""
|
32
|
+
#!/bin/bash
|
33
|
+
exit 0
|
34
|
+
"""
|
35
|
+
And a file named "spec/timeout_spec.rb" with:
|
36
|
+
"""
|
37
|
+
require 'spec_helper'
|
38
|
+
|
39
|
+
RSpec.describe 'Short running command', :type => :aruba do
|
40
|
+
before(:each) { aruba.config.exit_timeout = 5 }
|
41
|
+
|
42
|
+
before(:each) { run('cli') }
|
43
|
+
|
44
|
+
it { expect(last_command).to have_finished_in_time }
|
45
|
+
end
|
46
|
+
"""
|
47
|
+
When I run `rspec`
|
48
|
+
Then the specs should all pass
|
@@ -1,7 +1,9 @@
|
|
1
1
|
When /^I do aruba (.*)$/ do |aruba_step|
|
2
|
+
@aruba_exception = StandardError.new
|
3
|
+
|
2
4
|
begin
|
3
5
|
step(aruba_step)
|
4
|
-
rescue
|
6
|
+
rescue => e
|
5
7
|
@aruba_exception = e
|
6
8
|
end
|
7
9
|
end
|
@@ -26,3 +28,69 @@ end
|
|
26
28
|
Then /^the output should be (\d+) bytes long$/ do |length|
|
27
29
|
expect(all_output.length).to eq length.to_i
|
28
30
|
end
|
31
|
+
|
32
|
+
Then /^the feature(?:s)? should( not)?(?: all)? pass$/ do |negated|
|
33
|
+
if negated
|
34
|
+
step 'the output should contain " failed)"'
|
35
|
+
step 'the exit status should be 1'
|
36
|
+
else
|
37
|
+
step 'the output should not contain " failed)"'
|
38
|
+
step 'the exit status should be 0'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Then /^the feature(?:s)? should( not)?(?: all)? pass with:$/ do |negated, string|
|
43
|
+
if negated
|
44
|
+
step 'the output should contain " failed)"'
|
45
|
+
step 'the exit status should be 1'
|
46
|
+
else
|
47
|
+
step 'the output should not contain " failed)"'
|
48
|
+
step 'the exit status should be 0'
|
49
|
+
end
|
50
|
+
|
51
|
+
step 'the output should contain:', string if string
|
52
|
+
end
|
53
|
+
|
54
|
+
Then /^the spec(?:s)? should( not)?(?: all)? pass$/ do |negated|
|
55
|
+
if negated
|
56
|
+
step 'the output should not contain "0 failures"'
|
57
|
+
step 'the exit status should be 1'
|
58
|
+
else
|
59
|
+
step 'the output should contain "0 failures"'
|
60
|
+
step 'the exit status should be 0'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
Then /^the spec(?:s)? should( not)?(?: all)? pass with:$/ do |negated, string|
|
65
|
+
if negated
|
66
|
+
step 'the output should contain " failed)"'
|
67
|
+
step 'the exit status should be 1'
|
68
|
+
else
|
69
|
+
step 'the output should not contain " failed)"'
|
70
|
+
step 'the exit status should be 0'
|
71
|
+
end
|
72
|
+
|
73
|
+
step 'the output should contain:', string if string
|
74
|
+
end
|
75
|
+
|
76
|
+
Given(/^the default feature-test$/) do
|
77
|
+
step(
|
78
|
+
'a file named "features/default.feature" with:',
|
79
|
+
<<-EOS.strip_heredoc
|
80
|
+
Feature: Default Feature
|
81
|
+
|
82
|
+
This is the default feature
|
83
|
+
|
84
|
+
Scenario: Run command
|
85
|
+
Given I successfully run `cli`
|
86
|
+
EOS
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
Before do
|
91
|
+
aruba.config.exit_timeout = 15
|
92
|
+
end
|
93
|
+
|
94
|
+
Given(/^(?:an|the) executable(?: named)? "([^"]*)" with:$/) do |file_name, file_content|
|
95
|
+
step %(a file named "#{file_name}" with mode "0755" and with:), file_content
|
96
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
Feature: Check exit status of commands
|
2
|
+
|
3
|
+
Use the `the exit status should be \d`-step to check the exit status of the
|
4
|
+
last command which was executed.
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I use a fixture named "cli-app"
|
8
|
+
|
9
|
+
Scenario: Test for exit status of 0
|
10
|
+
Given an executable named "bin/cli" with:
|
11
|
+
"""
|
12
|
+
#!/bin/bash
|
13
|
+
exit 0
|
14
|
+
"""
|
15
|
+
And a file named "features/exit_status.feature" with:
|
16
|
+
"""
|
17
|
+
Feature: Exit status
|
18
|
+
Scenario: Run command
|
19
|
+
When I run `cli`
|
20
|
+
Then the exit status should be 0
|
21
|
+
"""
|
22
|
+
When I run `cucumber`
|
23
|
+
Then the features should all pass
|
24
|
+
|
25
|
+
Scenario: Test for exit status 1
|
26
|
+
Given an executable named "bin/cli" with:
|
27
|
+
"""
|
28
|
+
#!/bin/bash
|
29
|
+
exit 1
|
30
|
+
"""
|
31
|
+
And a file named "features/exit_status.feature" with:
|
32
|
+
"""
|
33
|
+
Feature: Failing program
|
34
|
+
Scenario: Run command
|
35
|
+
When I run `cli`
|
36
|
+
Then the exit status should be 1
|
37
|
+
"""
|
38
|
+
When I run `cucumber`
|
39
|
+
Then the features should all pass
|
40
|
+
|
41
|
+
Scenario: Test for non-zero exit status
|
42
|
+
Given an executable named "bin/cli" with:
|
43
|
+
"""
|
44
|
+
#!/bin/bash
|
45
|
+
exit 1
|
46
|
+
"""
|
47
|
+
And a file named "features/exit_status.feature" with:
|
48
|
+
"""
|
49
|
+
Feature: Failing program
|
50
|
+
Scenario: Run command
|
51
|
+
When I run `cli`
|
52
|
+
Then the exit status should not be 0
|
53
|
+
"""
|
54
|
+
When I run `cucumber`
|
55
|
+
Then the features should all pass
|
56
|
+
|
57
|
+
Scenario: Successfully run something
|
58
|
+
Given an executable named "bin/cli" with:
|
59
|
+
"""
|
60
|
+
#!/bin/bash
|
61
|
+
exit 0
|
62
|
+
"""
|
63
|
+
And a file named "features/exit_status.feature" with:
|
64
|
+
"""
|
65
|
+
Feature: Failing program
|
66
|
+
Scenario: Run command
|
67
|
+
When I successfully run `cli`
|
68
|
+
"""
|
69
|
+
When I run `cucumber`
|
70
|
+
Then the features should all pass
|
71
|
+
|
72
|
+
Scenario: Fail to run something successfully
|
73
|
+
Given an executable named "bin/cli" with:
|
74
|
+
"""
|
75
|
+
#!/bin/bash
|
76
|
+
exit 1
|
77
|
+
"""
|
78
|
+
And a file named "features/exit_status.feature" with:
|
79
|
+
"""
|
80
|
+
Feature: Failing program
|
81
|
+
Scenario: Run command
|
82
|
+
When I successfully run `cli`
|
83
|
+
"""
|
84
|
+
When I run `cucumber`
|
85
|
+
Then the features should not all pass
|
86
|
+
|
87
|
+
Scenario: Overwrite the default exit timeout via step
|
88
|
+
Given an executable named "bin/cli" with:
|
89
|
+
"""
|
90
|
+
#!/bin/bash
|
91
|
+
sleep 1
|
92
|
+
"""
|
93
|
+
And a file named "features/exit_status.feature" with:
|
94
|
+
"""
|
95
|
+
Feature: Failing program
|
96
|
+
Scenario: Run command
|
97
|
+
Given the default aruba timeout is 2 seconds
|
98
|
+
When I successfully run `cli`
|
99
|
+
"""
|
100
|
+
When I run `cucumber`
|
101
|
+
Then the features should all pass
|
102
|
+
|
103
|
+
Scenario: Successfully run something longer then the default time
|
104
|
+
Given an executable named "bin/cli" with:
|
105
|
+
"""
|
106
|
+
#!/bin/bash
|
107
|
+
sleep 1
|
108
|
+
"""
|
109
|
+
And a file named "features/exit_status.feature" with:
|
110
|
+
"""
|
111
|
+
Feature: Failing program
|
112
|
+
Scenario: Run command
|
113
|
+
Given the default aruba timeout is 0 seconds
|
114
|
+
When I successfully run `cli` for up to 2 seconds
|
115
|
+
"""
|
116
|
+
When I run `cucumber`
|
117
|
+
Then the features should all pass
|
118
|
+
|
119
|
+
Scenario: Unsuccessfully run something that takes too long
|
120
|
+
Given an executable named "bin/cli" with:
|
121
|
+
"""
|
122
|
+
#!/bin/bash
|
123
|
+
sleep 2
|
124
|
+
"""
|
125
|
+
And a file named "features/exit_status.feature" with:
|
126
|
+
"""
|
127
|
+
Feature: Failing program
|
128
|
+
Scenario: Run command
|
129
|
+
Given the default aruba timeout is 0 seconds
|
130
|
+
When I successfully run `cli` for up to 1 seconds
|
131
|
+
"""
|
132
|
+
When I run `cucumber`
|
133
|
+
Then the features should not all pass with:
|
134
|
+
"""
|
135
|
+
expected "cli" to have finished in time
|
136
|
+
"""
|