aruba 0.9.0.pre → 0.9.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +8 -3
- data/History.md +61 -19
- data/README.md +10 -6
- data/TODO.md +6 -1
- data/cucumber.yml +10 -6
- data/features/.nav +72 -0
- data/features/announce.feature +203 -0
- data/features/api/command/extract_text.feature +10 -0
- data/features/api/command/run.feature +6 -6
- data/features/api/command/stop_all_commands.feature +53 -0
- data/features/api/command/terminate_all_commands.feature +53 -0
- data/features/api/command/unescape_text.feature +12 -0
- data/features/api/command/which.feature +3 -3
- data/features/api/core/expand_path.feature +4 -4
- data/features/api/environment/append_environment_variable.feature +18 -8
- data/features/api/environment/prepend_environment_variable.feature +18 -8
- data/features/api/environment/set_environment_variable.feature +33 -16
- data/features/api/filesystem/cd.feature +23 -13
- data/features/api/filesystem/create_directory.feature +2 -2
- data/features/api/filesystem/disk_usage.feature +7 -6
- data/features/api/filesystem/does_exist.feature +2 -2
- data/features/api/filesystem/is_absolute.feature +2 -2
- data/features/api/filesystem/is_directory.feature +2 -2
- data/features/api/filesystem/is_file.feature +2 -2
- data/features/api/filesystem/is_relative.feature +2 -2
- data/features/api/filesystem/move.feature +119 -0
- data/features/cli/console.feature +3 -3
- data/features/commands/debug_command.feature +93 -0
- data/features/commands/environment_variables.feature +64 -0
- data/features/commands/flushing.feature +74 -0
- data/features/commands/interactive.feature +90 -0
- data/features/commands/output/all_output.feature +445 -0
- data/features/commands/output/stdout.feature +66 -0
- data/features/configuration/exit_timeout.feature +5 -5
- data/features/configuration/fixtures_directories.feature +3 -3
- data/features/configuration/fixtures_path_prefix.feature +1 -1
- data/features/configuration/home_directory.feature +4 -4
- data/features/configuration/io_timeout.feature +2 -2
- data/features/configuration/keep_ansi.feature +2 -2
- data/features/configuration/log_level.feature +3 -3
- data/features/configuration/physical_block_size.feature +3 -3
- data/features/configuration/usage.feature +159 -0
- data/features/core/cleanup_aruba_directory.feature +52 -0
- data/features/development/build.feature +16 -0
- data/features/development/test.feature +24 -0
- data/features/file_system_commands.feature +12 -12
- data/features/getting_started/supported_programming_languages.feature +89 -0
- data/features/hooks/after/command.feature +1 -1
- data/features/hooks/before/command.feature +2 -2
- data/features/matchers/collection/include_an_object.feature +72 -0
- data/features/matchers/timeouts.feature +2 -2
- data/features/output.feature +60 -181
- data/features/step_definitions/aruba_dev_steps.rb +17 -10
- data/features/step_definitions/hooks.rb +11 -0
- data/features/steps/commands/exit_statuses.feature +3 -3
- data/features/steps/commands/run.feature +0 -15
- data/features/steps/filesystem/copy.feature +45 -0
- data/features/steps/filesystem/create_directory.feature +47 -0
- data/features/steps/filesystem/create_file.feature +53 -0
- data/features/steps/filesystem/file_content.feature +1 -1
- data/features/steps/filesystem/move.feature +45 -0
- data/features/steps/filesystem/overwrite_file.feature +72 -0
- data/features/steps/filesystem/use_fixture.feature +77 -0
- data/features/usage/install.feature +8 -0
- data/{features/fixtures → fixtures}/cli-app/.gitignore +0 -0
- data/{features/fixtures → fixtures}/cli-app/.rspec +0 -0
- data/{features/fixtures → fixtures}/cli-app/README.md +0 -0
- data/{features/fixtures → fixtures}/cli-app/Rakefile +0 -0
- data/{features/fixtures → fixtures}/cli-app/bin/cli +0 -0
- data/{features/fixtures → fixtures}/cli-app/cli-app.gemspec +0 -0
- data/{features/fixtures → fixtures}/cli-app/features/support/env.rb +0 -0
- data/{features/fixtures → fixtures}/cli-app/lib/cli/app.rb +0 -0
- data/fixtures/cli-app/lib/cli/app/suppress_simple_cov_output.rb +15 -0
- data/{features/fixtures → fixtures}/cli-app/lib/cli/app/version.rb +0 -0
- data/{features/fixtures/empty-app → fixtures/cli-app}/script/console +3 -3
- data/{features/fixtures → fixtures}/cli-app/spec/spec_helper.rb +0 -0
- data/{features/fixtures → fixtures}/cli-app/spec/support/aruba.rb +0 -0
- data/{features/fixtures → fixtures}/copy/file.txt +0 -0
- data/{features/fixtures → fixtures}/empty-app/.gitignore +0 -0
- data/{features/fixtures → fixtures}/empty-app/.rspec +0 -0
- data/{features/fixtures → fixtures}/empty-app/README.md +0 -0
- data/{features/fixtures → fixtures}/empty-app/Rakefile +0 -0
- data/{features/fixtures → fixtures}/empty-app/bin/cli +0 -0
- data/{features/fixtures → fixtures}/empty-app/cli-app.gemspec +0 -0
- data/{features/fixtures → fixtures}/empty-app/lib/cli/app.rb +0 -0
- data/{features/fixtures → fixtures}/empty-app/lib/cli/app/version.rb +0 -0
- data/{features/fixtures/cli-app → fixtures/empty-app}/script/console +3 -3
- data/{features/fixtures → fixtures}/empty-app/spec/spec_helper.rb +0 -0
- data/{features/fixtures → fixtures}/fixtures-app/test.txt +0 -0
- data/fixtures/getting-started-app/.gitignore +4 -0
- data/fixtures/getting-started-app/Gemfile +4 -0
- data/fixtures/getting-started-app/README.md +3 -0
- data/fixtures/getting-started-app/features/support/env.rb +1 -0
- data/{features/fixtures → fixtures}/spawn_process/stderr.sh +0 -0
- data/lib/aruba/announcer.rb +6 -2
- data/lib/aruba/api.rb +0 -16
- data/lib/aruba/api/command.rb +64 -266
- data/lib/aruba/api/core.rb +24 -26
- data/lib/aruba/api/deprecated.rb +370 -12
- data/lib/aruba/api/filesystem.rb +64 -15
- data/lib/aruba/aruba_path.rb +4 -0
- data/lib/aruba/config.rb +1 -1
- data/lib/aruba/cucumber.rb +5 -449
- data/lib/aruba/cucumber/command.rb +378 -0
- data/lib/aruba/cucumber/core.rb +29 -0
- data/lib/aruba/cucumber/environment.rb +30 -0
- data/lib/aruba/cucumber/file.rb +210 -0
- data/lib/aruba/cucumber/hooks.rb +11 -14
- data/lib/aruba/cucumber/rvm.rb +3 -0
- data/lib/aruba/matchers/base/base_matcher.rb +94 -0
- data/lib/aruba/matchers/collection.rb +1 -0
- data/lib/aruba/matchers/collection/all_objects.rb +2 -0
- data/lib/aruba/matchers/collection/include_an_object.rb +120 -0
- data/lib/aruba/matchers/command/be_successfully_executed.rb +3 -3
- data/lib/aruba/matchers/command/have_exit_status.rb +2 -11
- data/lib/aruba/matchers/command/have_finished_in_time.rb +5 -5
- data/lib/aruba/matchers/command/have_output.rb +46 -0
- data/lib/aruba/matchers/command/have_output_on_stderr.rb +42 -0
- data/lib/aruba/matchers/command/have_output_on_stdout.rb +42 -0
- data/lib/aruba/matchers/command/have_output_size.rb +28 -0
- data/lib/aruba/matchers/directory/be_an_existing_directory.rb +1 -1
- data/lib/aruba/matchers/file/be_an_existing_file.rb +1 -1
- data/lib/aruba/matchers/file/have_file_content.rb +1 -1
- data/lib/aruba/matchers/file/have_file_size.rb +2 -2
- data/lib/aruba/matchers/file/have_same_file_content.rb +1 -1
- data/lib/aruba/matchers/path/have_permissions.rb +1 -1
- data/lib/aruba/platforms/aruba_file_creator.rb +2 -3
- data/lib/aruba/platforms/aruba_fixed_size_file_creator.rb +2 -3
- data/lib/aruba/platforms/determine_disk_usage.rb +23 -0
- data/lib/aruba/platforms/determine_file_size.rb +13 -0
- data/lib/aruba/platforms/disk_usage_calculator.rb +11 -0
- data/lib/aruba/platforms/local_environment.rb +15 -0
- data/lib/aruba/platforms/unix_environment_variables.rb +1 -1
- data/lib/aruba/platforms/unix_platform.rb +35 -14
- data/lib/aruba/process_monitor.rb +53 -7
- data/lib/aruba/processes/basic_process.rb +25 -5
- data/lib/aruba/processes/debug_process.rb +27 -25
- data/lib/aruba/processes/in_process.rb +7 -22
- data/lib/aruba/processes/spawn_process.rb +74 -31
- data/lib/aruba/rspec.rb +1 -6
- data/lib/aruba/version.rb +1 -1
- data/script/console +0 -1
- data/spec/aruba/api/environment/restore_env_spec.rb +65 -0
- data/spec/aruba/api/environment/set_env_spec.rb +42 -0
- data/spec/aruba/api/filesystem/file_size_spec.rb +28 -0
- data/spec/aruba/api_spec.rb +10 -7
- data/spec/aruba/matchers/command/have_output_size_spec.rb +25 -0
- data/spec/aruba/matchers/command_spec.rb +135 -4
- data/spec/aruba/spawn_process_spec.rb +1 -1
- metadata +107 -65
- data/.nav +0 -12
- data/features/debug.feature +0 -15
- data/features/fixtures/cli-app/spec/cli/app_spec.rb +0 -7
- data/features/flushing.feature +0 -26
- data/features/interactive.feature +0 -66
- data/features/no_clobber.feature +0 -25
- data/lib/aruba/disk_usage_calculator.rb +0 -7
@@ -0,0 +1,119 @@
|
|
1
|
+
Feature: Move file/directory
|
2
|
+
|
3
|
+
If you need to move some files/directories you can use the `#move`-method
|
4
|
+
command. If multiple arguments are given, the last one needs to be a directory.
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I use a fixture named "cli-app"
|
8
|
+
|
9
|
+
Scenario: Non-existing destination
|
10
|
+
Given a file named "spec/cd_spec.rb" with:
|
11
|
+
"""ruby
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
RSpec.describe 'Move', :type => :aruba do
|
15
|
+
let(:old_location) { 'old_dir.d' }
|
16
|
+
let(:new_location) { 'new_dir.d' }
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
create_directory old_location
|
20
|
+
move old_location, new_location
|
21
|
+
end
|
22
|
+
|
23
|
+
it { expect(new_location).to be_an_existing_directory }
|
24
|
+
end
|
25
|
+
"""
|
26
|
+
When I run `rspec`
|
27
|
+
Then the specs should all pass
|
28
|
+
|
29
|
+
Scenario: Existing destination
|
30
|
+
Given a file named "spec/cd_spec.rb" with:
|
31
|
+
"""ruby
|
32
|
+
require 'spec_helper'
|
33
|
+
|
34
|
+
RSpec.describe 'Move', :type => :aruba do
|
35
|
+
let(:old_location) { 'old_dir.d' }
|
36
|
+
let(:new_location) { 'new_dir.d' }
|
37
|
+
|
38
|
+
before(:each) do
|
39
|
+
create_directory old_location
|
40
|
+
create_directory new_location
|
41
|
+
|
42
|
+
move old_location, new_location
|
43
|
+
end
|
44
|
+
|
45
|
+
it { expect(File.join(new_location, old_location)).to be_an_existing_directory }
|
46
|
+
end
|
47
|
+
"""
|
48
|
+
When I run `rspec`
|
49
|
+
Then the specs should all pass
|
50
|
+
|
51
|
+
Scenario: Source is fixture path
|
52
|
+
Given a file named "spec/cd_spec.rb" with:
|
53
|
+
"""ruby
|
54
|
+
require 'spec_helper'
|
55
|
+
|
56
|
+
RSpec.describe 'Move', :type => :aruba do
|
57
|
+
let(:old_location) { '%/old_dir.d' }
|
58
|
+
let(:new_location) { 'new_dir.d' }
|
59
|
+
|
60
|
+
it { expect { move old_location, new_location }.to raise_error ArgumentError, /fixture/ }
|
61
|
+
end
|
62
|
+
"""
|
63
|
+
When I run `rspec`
|
64
|
+
Then the specs should all pass
|
65
|
+
|
66
|
+
Scenario: Destination is fixture path
|
67
|
+
Given a file named "spec/cd_spec.rb" with:
|
68
|
+
"""ruby
|
69
|
+
require 'spec_helper'
|
70
|
+
|
71
|
+
RSpec.describe 'Move', :type => :aruba do
|
72
|
+
let(:old_location) { 'old_dir.d' }
|
73
|
+
let(:new_location) { '%/new_dir.d' }
|
74
|
+
|
75
|
+
it { expect { move old_location, new_location }.to raise_error ArgumentError, /fixture/ }
|
76
|
+
end
|
77
|
+
"""
|
78
|
+
When I run `rspec`
|
79
|
+
Then the specs should all pass
|
80
|
+
|
81
|
+
Scenario: Multiple sources and destination is directory
|
82
|
+
Given a file named "spec/cd_spec.rb" with:
|
83
|
+
"""ruby
|
84
|
+
require 'spec_helper'
|
85
|
+
|
86
|
+
RSpec.describe 'Move', :type => :aruba do
|
87
|
+
let(:old_location) { %w(old_dir1.d old_dir2.d) }
|
88
|
+
let(:new_location) { 'new_dir.d' }
|
89
|
+
|
90
|
+
before :each do
|
91
|
+
old_location.each { |l| create_directory l }
|
92
|
+
move old_location, new_location
|
93
|
+
end
|
94
|
+
|
95
|
+
it { expect(old_location.map { |l| File.join(new_location, l) }).to all be_an_existing_directory }
|
96
|
+
end
|
97
|
+
"""
|
98
|
+
When I run `rspec`
|
99
|
+
Then the specs should all pass
|
100
|
+
|
101
|
+
Scenario: Multiple sources and destination is file
|
102
|
+
Given a file named "spec/cd_spec.rb" with:
|
103
|
+
"""ruby
|
104
|
+
require 'spec_helper'
|
105
|
+
|
106
|
+
RSpec.describe 'Move', :type => :aruba do
|
107
|
+
let(:old_location) { %w(old_dir1.d old_dir2.d) }
|
108
|
+
let(:new_location) { 'new_file.txt' }
|
109
|
+
|
110
|
+
before :each do
|
111
|
+
old_location.each { |l| create_directory l }
|
112
|
+
touch new_location
|
113
|
+
end
|
114
|
+
|
115
|
+
it { expect { move old_location, new_location }.to raise_error ArgumentError, /Multiple sources/ }
|
116
|
+
end
|
117
|
+
"""
|
118
|
+
When I run `rspec`
|
119
|
+
Then the specs should all pass
|
@@ -11,7 +11,7 @@ Feature: Aruba Console
|
|
11
11
|
aruba:001:0>
|
12
12
|
"""
|
13
13
|
|
14
|
-
@
|
14
|
+
@unsupported-on-platform-java
|
15
15
|
Scenario: Show help
|
16
16
|
Given I run `aruba console` interactively
|
17
17
|
And I type "aruba_help"
|
@@ -29,7 +29,7 @@ Feature: Aruba Console
|
|
29
29
|
Documentation:
|
30
30
|
"""
|
31
31
|
|
32
|
-
@
|
32
|
+
@unsupported-on-platform-java
|
33
33
|
Scenario: Show methods
|
34
34
|
Given I run `aruba console` interactively
|
35
35
|
And I type "aruba_methods"
|
@@ -43,7 +43,7 @@ Feature: Aruba Console
|
|
43
43
|
* setup_aruba
|
44
44
|
"""
|
45
45
|
|
46
|
-
@
|
46
|
+
@unsupported-on-platform-java
|
47
47
|
Scenario: Has history
|
48
48
|
Given I run `aruba console` interactively
|
49
49
|
And I type "aruba_methods"
|
@@ -0,0 +1,93 @@
|
|
1
|
+
Feature: Debug your command in cucumber-test-run
|
2
|
+
|
3
|
+
As a developer
|
4
|
+
I want to use some debugger in my code and therefor need system() to execute my program
|
5
|
+
In order to find a bug
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use a fixture named "cli-app"
|
9
|
+
And the default aruba exit timeout is 60 seconds
|
10
|
+
|
11
|
+
Scenario: Can handle exit status 0
|
12
|
+
Given an executable named "bin/cli" with:
|
13
|
+
"""bash
|
14
|
+
#!/usr/bin/env bash
|
15
|
+
|
16
|
+
exit 0
|
17
|
+
"""
|
18
|
+
And a file named "features/debug.feature" with:
|
19
|
+
"""cucumber
|
20
|
+
Feature: Exit status in debug environment
|
21
|
+
|
22
|
+
@debug
|
23
|
+
Scenario: Run program with debug code
|
24
|
+
When I run `cli`
|
25
|
+
Then the exit status should be 0
|
26
|
+
"""
|
27
|
+
When I successfully run `cucumber`
|
28
|
+
Then the features should all pass
|
29
|
+
|
30
|
+
Scenario: Can handle exit status 1
|
31
|
+
Given an executable named "bin/cli" with:
|
32
|
+
"""bash
|
33
|
+
#!/usr/bin/env bash
|
34
|
+
|
35
|
+
exit 1
|
36
|
+
"""
|
37
|
+
And a file named "features/debug.feature" with:
|
38
|
+
"""cucumber
|
39
|
+
Feature: Exit status in debug environment
|
40
|
+
|
41
|
+
@debug
|
42
|
+
Scenario: Run program with debug code
|
43
|
+
When I run `cli`
|
44
|
+
Then the exit status should be 1
|
45
|
+
"""
|
46
|
+
When I successfully run `cucumber`
|
47
|
+
Then the features should all pass
|
48
|
+
|
49
|
+
@unsupported-on-ruby-older-193
|
50
|
+
Scenario: You can use a debug repl in your cli program
|
51
|
+
|
52
|
+
If you want to debug a strange error, which only occures in one of your
|
53
|
+
`cucumber`-tests, the `@debug`-tag becomes handy. You can add `@debug` in
|
54
|
+
front of your feature/scenario to make `binding.pry` or `byebug` work in
|
55
|
+
your program.
|
56
|
+
|
57
|
+
Please make sure, that there's a statement after the `binding.pry`-call.
|
58
|
+
Otherwise you might not get an interactive shell, because your program will
|
59
|
+
just exit.
|
60
|
+
|
61
|
+
We are going to demonstrate this using `pry`, but any other interactive
|
62
|
+
debugger for any other programming language should also work.
|
63
|
+
|
64
|
+
Given an executable named "bin/cli" with:
|
65
|
+
"""ruby
|
66
|
+
#!/usr/bin/env ruby
|
67
|
+
|
68
|
+
$stderr.sync = true
|
69
|
+
$stdout.sync = true
|
70
|
+
|
71
|
+
require 'pry'
|
72
|
+
binding.pry
|
73
|
+
|
74
|
+
exit 0
|
75
|
+
"""
|
76
|
+
And a file named "features/debug.feature" with:
|
77
|
+
"""cucumber
|
78
|
+
Feature: Exit status in debug environment
|
79
|
+
|
80
|
+
@debug
|
81
|
+
Scenario: Run program with debug code
|
82
|
+
When I run `cli`
|
83
|
+
Then the exit status should be 0
|
84
|
+
"""
|
85
|
+
When I run `cucumber` interactively
|
86
|
+
And I stop the command started last if output contains:
|
87
|
+
"""
|
88
|
+
pry
|
89
|
+
"""
|
90
|
+
Then the output should contain:
|
91
|
+
"""
|
92
|
+
binding.pry
|
93
|
+
"""
|
@@ -0,0 +1,64 @@
|
|
1
|
+
Feature: Modify environment variables
|
2
|
+
|
3
|
+
In order to test command line applications which make use of environment variables
|
4
|
+
As a developer using Cucumber
|
5
|
+
I want to use the command environment variable step
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use a fixture named "cli-app"
|
9
|
+
|
10
|
+
Scenario: Change/Set value of arbitrary environment variable
|
11
|
+
Given an executable named "bin/cli" with:
|
12
|
+
"""ruby
|
13
|
+
#!/usr/bin/env ruby
|
14
|
+
|
15
|
+
puts ENV['LONG_LONG_VARIABLE']
|
16
|
+
"""
|
17
|
+
And a file named "features/environment_variable.feature" with:
|
18
|
+
"""cucumber
|
19
|
+
Feature: Flushing output
|
20
|
+
Scenario: Run command
|
21
|
+
Given I set the environment variables to:
|
22
|
+
| variable | value |
|
23
|
+
| LONG_LONG_VARIABLE | long_value |
|
24
|
+
When I run `cli`
|
25
|
+
Then the output should contain "long_value"
|
26
|
+
"""
|
27
|
+
When I run `cucumber`
|
28
|
+
Then the features should all pass
|
29
|
+
|
30
|
+
Scenario: Change the HOME-variable of current user during test using custom step
|
31
|
+
Given an executable named "bin/cli" with:
|
32
|
+
"""ruby
|
33
|
+
#!/usr/bin/env ruby
|
34
|
+
|
35
|
+
puts File.expand_path('~/')
|
36
|
+
"""
|
37
|
+
And a file named "features/home_directory.feature" with:
|
38
|
+
"""cucumber
|
39
|
+
Feature: Run command with different home directory
|
40
|
+
Scenario: Run command
|
41
|
+
Given a mocked home directory
|
42
|
+
When I run `cli`
|
43
|
+
Then the output should contain "tmp/aruba"
|
44
|
+
"""
|
45
|
+
When I run `cucumber`
|
46
|
+
Then the features should all pass
|
47
|
+
|
48
|
+
Scenario: Change the HOME-variable of current user during test using tag
|
49
|
+
Given an executable named "bin/cli" with:
|
50
|
+
"""ruby
|
51
|
+
#!/usr/bin/env ruby
|
52
|
+
|
53
|
+
puts File.expand_path('~/')
|
54
|
+
"""
|
55
|
+
And a file named "features/home_directory.feature" with:
|
56
|
+
"""cucumber
|
57
|
+
Feature: Run command
|
58
|
+
@mocked_home_directory
|
59
|
+
Scenario: Run command
|
60
|
+
When I run `cli`
|
61
|
+
Then the output should contain "tmp/aruba"
|
62
|
+
"""
|
63
|
+
When I run `cucumber`
|
64
|
+
Then the features should all pass
|
@@ -0,0 +1,74 @@
|
|
1
|
+
Feature: Flushing the output of your application
|
2
|
+
|
3
|
+
In order to test processes that output a lot of data
|
4
|
+
As a developer using Aruba
|
5
|
+
I want to make sure that large amounts of output aren't buffered
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use a fixture named "cli-app"
|
9
|
+
|
10
|
+
Scenario: A little output
|
11
|
+
Given an executable named "bin/cli" with:
|
12
|
+
"""bash
|
13
|
+
#!/usr/bin/env bash
|
14
|
+
|
15
|
+
for ((c=0; c<256; c = c+1)); do
|
16
|
+
echo -n "a"
|
17
|
+
done
|
18
|
+
"""
|
19
|
+
And a file named "features/flushing.feature" with:
|
20
|
+
"""cucumber
|
21
|
+
Feature: Flushing output
|
22
|
+
Scenario: Run command
|
23
|
+
When I run `cli`
|
24
|
+
Then the output should contain "a"
|
25
|
+
And the output should be 256 bytes long
|
26
|
+
And the exit status should be 0
|
27
|
+
"""
|
28
|
+
When I run `cucumber`
|
29
|
+
Then the features should all pass
|
30
|
+
|
31
|
+
Scenario: Tons of output
|
32
|
+
Given the default aruba exit timeout is 10 seconds
|
33
|
+
And an executable named "bin/cli" with:
|
34
|
+
"""bash
|
35
|
+
#!/usr/bin/env bash
|
36
|
+
|
37
|
+
for ((c=0; c<65536; c = c+1)); do
|
38
|
+
echo -n "a"
|
39
|
+
done
|
40
|
+
"""
|
41
|
+
And a file named "features/flushing.feature" with:
|
42
|
+
"""cucumber
|
43
|
+
Feature: Flushing output
|
44
|
+
Scenario: Run command
|
45
|
+
When I run `cli`
|
46
|
+
Then the output should contain "a"
|
47
|
+
And the output should be 65536 bytes long
|
48
|
+
And the exit status should be 0
|
49
|
+
"""
|
50
|
+
When I run `cucumber`
|
51
|
+
Then the features should all pass
|
52
|
+
|
53
|
+
Scenario: Tons of interactive output
|
54
|
+
Given the default aruba exit timeout is 10 seconds
|
55
|
+
And an executable named "bin/cli" with:
|
56
|
+
"""bash
|
57
|
+
#!/usr/bin/env bash
|
58
|
+
|
59
|
+
read size; for ((c=0; c<$size; c = c+1)); do
|
60
|
+
echo -n "a"
|
61
|
+
done
|
62
|
+
"""
|
63
|
+
And a file named "features/flushing.feature" with:
|
64
|
+
"""cucumber
|
65
|
+
Feature: Flushing output
|
66
|
+
Scenario: Run command
|
67
|
+
When I run `cli` interactively
|
68
|
+
And I type "65536"
|
69
|
+
Then the output should contain "a"
|
70
|
+
And the output should be 65536 bytes long
|
71
|
+
And the exit status should be 0
|
72
|
+
"""
|
73
|
+
When I run `cucumber`
|
74
|
+
Then the features should all pass
|
@@ -0,0 +1,90 @@
|
|
1
|
+
Feature: Interactive process control
|
2
|
+
|
3
|
+
In order to test interactive command line applications
|
4
|
+
As a developer using Cucumber
|
5
|
+
I want to use the interactive session steps
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I use a fixture named "cli-app"
|
9
|
+
|
10
|
+
@wip-jruby-java-1.6
|
11
|
+
Scenario: Running ruby interactively
|
12
|
+
Given an executable named "bin/cli" with:
|
13
|
+
"""bash
|
14
|
+
#!/usr/bin/env ruby
|
15
|
+
|
16
|
+
while res = gets.chomp
|
17
|
+
break if res == "quit"
|
18
|
+
puts res.reverse
|
19
|
+
end
|
20
|
+
"""
|
21
|
+
And a file named "features/interactive.feature" with:
|
22
|
+
"""cucumber
|
23
|
+
Feature: Run command
|
24
|
+
Scenario: Run command
|
25
|
+
When I run `cli` interactively
|
26
|
+
And I type "hello, world"
|
27
|
+
And I type "quit"
|
28
|
+
Then it should pass with "dlrow ,olleh"
|
29
|
+
"""
|
30
|
+
When I run `cucumber`
|
31
|
+
Then the features should all pass
|
32
|
+
|
33
|
+
@posix
|
34
|
+
Scenario: Running a native binary interactively
|
35
|
+
Given a file named "features/interactive.feature" with:
|
36
|
+
"""cucumber
|
37
|
+
Feature: Run command
|
38
|
+
Scenario: Run command
|
39
|
+
When I run `cat` interactively
|
40
|
+
And I type "Hello, world"
|
41
|
+
And I type ""
|
42
|
+
Then the output should contain "Hello, world"
|
43
|
+
"""
|
44
|
+
When I run `cucumber`
|
45
|
+
Then the features should all pass
|
46
|
+
|
47
|
+
@posix
|
48
|
+
Scenario: Pipe in a file
|
49
|
+
Given a file named "features/interactive.feature" with:
|
50
|
+
"""cucumber
|
51
|
+
Feature: Run command
|
52
|
+
Scenario: Run command
|
53
|
+
Given a file named "test.txt" with "line1\nline2"
|
54
|
+
When I run `cat` interactively
|
55
|
+
And I pipe in the file "test.txt"
|
56
|
+
Then the output should contain "line1\nline2"
|
57
|
+
"""
|
58
|
+
When I run `cucumber`
|
59
|
+
Then the features should all pass
|
60
|
+
|
61
|
+
@posix
|
62
|
+
Scenario: Close stdin stream
|
63
|
+
Given a file named "features/interactive.feature" with:
|
64
|
+
"""cucumber
|
65
|
+
Feature: Run command
|
66
|
+
Scenario: Run command
|
67
|
+
When I run `cat` interactively
|
68
|
+
And I type "Hello, world"
|
69
|
+
And I close the stdin stream
|
70
|
+
Then the output should contain "Hello, world"
|
71
|
+
"""
|
72
|
+
When I run `cucumber`
|
73
|
+
Then the features should all pass
|
74
|
+
|
75
|
+
@posix
|
76
|
+
Scenario: All processes are stopped before checking for filesystem changes
|
77
|
+
|
78
|
+
See: http://github.com/aslakhellesoy/aruba/issues#issue/17 for context
|
79
|
+
|
80
|
+
Given a file named "features/interactive.feature" with:
|
81
|
+
"""cucumber
|
82
|
+
Feature: Run command
|
83
|
+
Scenario: Run command
|
84
|
+
Given a directory named "rename_me"
|
85
|
+
When I run `mv rename_me renamed` interactively
|
86
|
+
Then the directory "renamed" should exist
|
87
|
+
And the directory "rename_me" should not exist
|
88
|
+
"""
|
89
|
+
When I run `cucumber`
|
90
|
+
Then the features should all pass
|