Skip to content

Commit

Permalink
Merge pull request #703 from cucumber/several-cuke-improvements
Browse files Browse the repository at this point in the history
Several cuke improvements
  • Loading branch information
mvz authored Jan 31, 2020
2 parents e15f894 + 2a0b9ff commit 2abe6c7
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 44 deletions.
20 changes: 11 additions & 9 deletions features/02_configure_aruba/home_directory.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Feature: Configure the home directory to be used with aruba
I want to configure the home directory
In order to have a better isolation of tests

Be careful to set the HOME-variable aka `config.home_directory` to something
Be careful when you set the HOME-variable aka `config.home_directory` to something
else than `<project_root>/tmp/aruba`. This is a dance with the devil and
violates the isolation of your test suite. Thus will be not supported from
aruba as of 1.0.0.
Expand Down Expand Up @@ -34,31 +34,33 @@ Feature: Configure the home directory to be used with aruba
end
Aruba.configure do |config|
puts %(The default value is "#{config.home_directory}")
puts %(The value is "#{config.home_directory}")
end
"""
Then I successfully run `cucumber`
Then the output should contain:
"""
The default value is "."
The value is "."
"""

Scenario: Set to aruba's working directory
Scenario: Set a path inside aruba's working directory
Given a file named "features/support/aruba_config.rb" with:
"""ruby
Aruba.configure do |config|
# Use aruba working directory
config.home_directory = File.join(config.root_directory, config.working_directory)
config.home_directory = File.join(config.root_directory,
config.working_directory,
"home")
end
Aruba.configure do |config|
puts %(The default value is "#{config.home_directory}")
puts %(The value is "#{config.home_directory}")
end
"""
Then I successfully run `cucumber`
Then the output should match:
"""
The default value is "/.*/tmp/aruba"
The value is "/.*/tmp/aruba/home"
"""

Scenario: Set to some other path (deprecated)
Expand All @@ -70,11 +72,11 @@ Feature: Configure the home directory to be used with aruba
end
Aruba.configure do |config|
puts %(The default value is "#{config.home_directory}")
puts %(The value is "#{config.home_directory}")
end
"""
Then I successfully run `cucumber`
Then the output should contain:
"""
The default value is "/tmp/home"
The value is "/tmp/home"
"""
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,38 @@ Feature: All output of commands which were executed
When I run `cucumber`
Then the features should all pass

Scenario: Detect combined output from normal and interactive processes
Given an executable named "bin/aruba-test-cli1" with:
"""
#!/usr/bin/env bash
echo 'This is cli1'
"""
And an executable named "bin/aruba-test-cli2" with:
"""
#!/usr/bin/env ruby
while input = gets do
break if "" == input
puts input
end
"""
And a file named "features/output.feature" with:
"""
Feature: Run command
Scenario: Run command
When I run `aruba-test-cli1`
When I run `aruba-test-cli2` interactively
And I type "This is cli2"
And I type ""
Then the stdout should contain exactly:
\"\"\"
This is cli1
This is cli2
\"\"\"
"""
When I run `cucumber`
Then the features should all pass

Scenario: Handle little output
Given an executable named "bin/aruba-test-cli" with:
"""bash
Expand Down Expand Up @@ -496,38 +528,6 @@ Feature: All output of commands which were executed
When I run `cucumber`
Then the features should all pass

Scenario: Detect output from all processes normal and interactive ones
Given an executable named "bin/aruba-test-cli1" with:
"""
#!/usr/bin/env bash
echo 'This is cli1'
"""
And an executable named "bin/aruba-test-cli2" with:
"""
#!/usr/bin/env ruby
while input = gets do
break if "" == input
puts input
end
"""
And a file named "features/output.feature" with:
"""
Feature: Run command
Scenario: Run command
When I run `aruba-test-cli1`
When I run `aruba-test-cli2` interactively
And I type "This is cli2"
And I type ""
Then the stdout should contain exactly:
\"\"\"
This is cli1
This is cli2
\"\"\"
"""
When I run `cucumber`
Then the features should all pass

Scenario: Detect output from named source
Given a file named "features/output.feature" with:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: STDERR of commands which were executed
Background:
Given I use a fixture named "cli-app"

Scenario: Detect stderr from all processes
Scenario: Detect stderr from each process
Given a file named "features/output.feature" with:
"""
Feature: Run command
Expand All @@ -29,6 +29,25 @@ Feature: STDERR of commands which were executed
When I run `cucumber`
Then the features should all pass

Scenario: Detect stderr from all processes
Given a file named "features/output.feature" with:
"""
Feature: Run command
Scenario: Run command
When I run `bash -c 'printf "hello world!\n" >&2'`
And I run `bash -c 'cat >&2 '` interactively
And I type "hola"
And I type ""
Then the stderr should contain:
\"\"\"
hello world!
hola
\"\"\"
And the stdout should not contain anything
"""
When I run `cucumber`
Then the features should all pass

Scenario: Detect stderr from named source
Given a file named "features/output.feature" with:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Feature: STDOUT of commands which were executed
When I run `cucumber`
Then the features should all pass

Scenario: Detect stdout from all processes including interactive ones
Scenario: Detect stdout from each process including interactive ones
Given a file named "features/output.feature" with:
"""
Feature: Run command
Expand All @@ -87,6 +87,25 @@ Feature: STDOUT of commands which were executed
When I run `cucumber`
Then the features should all pass

Scenario: Detect stdout from all processes
Given a file named "features/output.feature" with:
"""
Feature: Run command
Scenario: Run command
When I run `printf "hello world!\n"`
And I run `cat` interactively
And I type "hola"
And I type ""
Then the stdout should contain:
\"\"\"
hello world!
hola
\"\"\"
And the stderr should not contain anything
"""
When I run `cucumber`
Then the features should all pass

Scenario: Detect stdout from named source
Given a file named "features/output.feature" with:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Getting started with RSpec and aruba

\* Setup Aruba Test directory
\* Clear environment (ENV)
\* Make HOME variable configurable via `arub.config.home_directory`
\* Make HOME variable configurable via `aruba.config.home_directory`
\* Configure `aruba` via `RSpec` metadata
\* Activate announcers based on `RSpec` metadata

Expand Down

0 comments on commit 2abe6c7

Please sign in to comment.