features/output.feature in aruba-0.5.0 vs features/output.feature in aruba-0.5.1
- old
+ new
@@ -3,110 +3,94 @@
In order to specify expected output
As a developer using Cucumber
I want to use the "the output should contain" step
@posix
- Scenario: Run unknown command
- When I run `neverever gonna work`
- Then the output should contain:
- """
- No such file or directory - neverever
- """
-
- @posix
Scenario: Detect subset of one-line output
- When I run `ruby -e 'puts \"hello world\"'`
+ When I run `printf 'hello world'`
Then the output should contain "hello world"
- @posix
- Scenario: Detect subset of one-line output
- When I run `echo 'hello world'`
- Then the output should contain "hello world"
-
Scenario: Detect absence of one-line output
- When I run `ruby -e 'puts \"hello world\"'`
+ When I run `printf "hello world"`
Then the output should not contain "good-bye"
Scenario: Detect subset of multiline output
- When I run `ruby -e 'puts \"hello\\nworld\"'`
+ When I run `printf "hello\nworld"`
Then the output should contain:
"""
hello
"""
- Scenario: Detect subset of multiline output
- When I run `ruby -e 'puts \"hello\\nworld\"'`
+ Scenario: Detect absence of multiline output
+ When I run `printf "hello\nworld"`
Then the output should not contain:
"""
good-bye
"""
@posix
Scenario: Detect exact one-line output
- When I run `ruby -e 'puts \"hello world\"'`
+ When I run `printf "hello world"`
Then the output should contain exactly:
"""
hello world
-
"""
@ansi
@posix
Scenario: Detect exact one-line output with ANSI output
- When I run `ruby -e 'puts \"\e[36mhello world\e[0m\"'`
+ When I run `printf "\e[36mhello world\e[0m"`
Then the output should contain exactly:
"""
\e[36mhello world\e[0m
-
"""
@posix
Scenario: Detect exact one-line output with ANSI output stripped by default
- When I run `ruby -e 'puts \"\e[36mhello world\e[0m\"'`
+ When I run `printf "\e[36mhello world\e[0m"`
Then the output should contain exactly:
"""
hello world
-
"""
+
@posix
Scenario: Detect exact multiline output
- When I run `ruby -e 'puts "hello\nworld"'`
+ When I run `printf "hello\nworld"`
Then the output should contain exactly:
"""
hello
world
-
"""
@announce
Scenario: Detect subset of one-line output with regex
- When I run `ruby --version`
+ When I run `printf "hello, ruby"`
Then the output should contain "ruby"
- And the output should match /ruby ([\d]+\.[\d]+\.[\d]+)(\w*\d*)? \(.*$/
+ And the output should match /^hello(, world)?/
@announce
@posix
Scenario: Detect subset of multiline output with regex
- When I run `ruby -e 'puts "hello\nworld\nextra line1\nextra line2\nimportant line"'`
+ When I run `printf "hello\nworld\nextra line1\nextra line2\nimportant line"`
Then the output should match:
"""
he..o
wor.d
.*
important line
"""
@announce
Scenario: Negative matching of one-line output with regex
- When I run `ruby --version`
+ When I run `printf "hello, ruby"`
Then the output should contain "ruby"
And the output should not match /ruby is a better perl$/
@announce
@posix
Scenario: Negative matching of multiline output with regex
- When I run `ruby -e 'puts "hello\nworld\nextra line1\nextra line2\nimportant line"'`
+ When I run `printf "hello\nworld\nextra line1\nextra line2\nimportant line"`
Then the output should not match:
"""
ruby
is
a
@@ -115,153 +99,153 @@
"""
@announce
@posix
Scenario: Match passing exit status and partial output
- When I run `ruby -e 'puts "hello\nworld"'`
+ When I run `printf "hello\nworld"`
Then it should pass with:
"""
hello
"""
@posix
Scenario: Match passing exit status and exact output
- When I run `ruby -e 'puts "hello\nworld"'`
+ When I run `printf "hello\nworld"`
Then it should pass with exactly:
"""
hello
world
-
"""
@announce-stdout
Scenario: Match failing exit status and partial output
- When I run `ruby -e 'puts \"hello\\nworld\";exit 99'`
+ When I run `bash -c '(printf "hello\nworld";exit 99)'`
Then it should fail with:
"""
hello
"""
@posix
Scenario: Match failing exit status and exact output
- When I run `ruby -e 'puts "hello\nworld";exit 99'`
+ When I run `bash -c '(printf "hello\nworld";exit 99)'`
Then it should fail with exactly:
"""
hello
world
-
"""
@announce-stdout
@posix
Scenario: Match failing exit status and output with regex
- When I run `ruby -e 'puts \"hello\\nworld\";exit 99'`
+ When I run `bash -c '(printf "hello\nworld";exit 99)'`
Then it should fail with regex:
"""
hello\s*world
"""
@announce-cmd
@posix
Scenario: Match output in stdout
- When I run `ruby -e 'puts \"hello\\nworld\"'`
+ When I run `printf "hello\nworld"`
Then the stdout should contain "hello"
Then the stderr should not contain "hello"
@announce
Scenario: Match output on several lines
- When I run `ruby -e 'puts %{GET /}'`
+ When I run `printf 'GET /'`
Then the stdout should contain:
"""
GET /
"""
@posix
Scenario: Match output on several lines using quotes
- When I run `ruby -e 'puts %{GET "/"}'`
+ When I run `printf 'GET "/"'`
Then the stdout should contain:
"""
GET "/"
"""
@posix
- Scenario: Match output in stdout
- When I run `ruby -e 'puts \"hello\\nworld\"'`
- Then the stdout should contain "hello"
- Then the stderr should not contain "hello"
-
-
- @posix
Scenario: Detect output from all processes
- When I run `ruby -e 'puts \"hello world!\"'`
- And I run `ruby -e 'puts gets.chomp.reverse'` interactively
- And I type "hello"
+ When I run `printf "hello world!\n"`
+ And I run `cat` interactively
+ And I type "hola"
+ And I type ""
Then the output should contain exactly:
"""
hello world!
- olleh
+ hola
"""
@posix
Scenario: Detect stdout from all processes
- When I run `ruby -e 'puts \"hello world!\"'`
- And I run `ruby -e 'puts gets.chomp.reverse'` interactively
- And I type "hello"
+ 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!
- olleh
+ hola
+
"""
- And the stderr should not contain:
- """
- hello world!
- olleh
- """
+ And the stderr should not contain anything
@posix
Scenario: Detect stderr from all processes
- When I run `ruby -e 'STDERR.puts \"hello world!\"'`
- And I run `ruby -e 'STDERR.puts gets.chomp.reverse'` interactively
- And I type "hello"
+ 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!
- olleh
+ hola
"""
- And the stdout should not contain:
- """
- hello world!
- olleh
- """
+ And the stdout should not contain anything
Scenario: Detect output from named source
- When I run `ruby -e 'puts :simple'`
- And I run `ruby -e 'puts gets.chomp'` interactively
+ When I run `printf 'simple'`
+ And I run `cat` interactively
And I type "interactive"
- Then the output from "ruby -e 'puts :simple'" should contain "simple"
- And the output from "ruby -e 'puts gets.chomp'" should not contain "simple"
+ And I type ""
+ Then the output from "printf 'simple'" should contain "simple"
+ And the output from "printf 'simple'" should contain exactly "simple"
+ And the output from "printf 'simple'" should contain exactly:
+ """
+ simple
+ """
+ And the output from "cat" should not contain "simple"
Scenario: Detect stdout from named source
- When I run `ruby -e 'puts :hello'`
- And I run `ruby -e 'puts :goodbye'`
- Then the stdout from "ruby -e 'puts :hello'" should contain "hello"
- And the stderr from "ruby -e 'puts :hello'" should not contain "hello"
- And the stdout from "ruby -e 'puts :goodbye'" should not contain "hello"
+ When I run `printf 'hello'`
+ And I run `printf 'goodbye'`
+ Then the stdout from "printf 'hello'" should contain "hello"
+ And the stdout from "printf 'hello'" should contain exactly "hello"
+ And the stdout from "printf 'hello'" should contain exactly:
+ """
+ hello
+ """
+ And the stderr from "printf 'hello'" should not contain "hello"
+ And the stdout from "printf 'goodbye'" should not contain "hello"
Scenario: Detect stderr from named source
- When I run `ruby -e 'STDERR.puts :hello'`
- And I run `ruby -e 'puts :goodbye'`
- Then the stderr from "ruby -e 'STDERR.puts :hello'" should contain "hello"
- And the stdout from "ruby -e 'STDERR.puts :hello'" should not contain "hello"
- And the stderr from "ruby -e 'puts :goodbye'" should not contain "hello"
+ When I run `bash -c 'printf hello >&2'`
+ And I run `printf goodbye`
+ Then the stderr from "bash -c 'printf hello >&2'" should contain "hello"
+ And the stderr from "bash -c 'printf hello >&2'" should contain exactly "hello"
+ And the stderr from "bash -c 'printf hello >&2'" should contain exactly:
+ """
+ hello
+ """
+ And the stdout from "bash -c 'printf hello >&2'" should not contain "hello"
+ And the stderr from "printf goodbye" should not contain "hello"
- @wip
- Scenario: Detect output from named source with custom name
-
Scenario: Detect second output from named source with custom name
When I set env variable "ARUBA_TEST_VAR" to "first"
- And I run `ruby -e 'puts ENV[%q(ARUBA_TEST_VAR)]'`
- Then the output from "ruby -e 'puts ENV[%q(ARUBA_TEST_VAR)]'" should contain "first"
+ And I run `bash -c 'printf $ARUBA_TEST_VAR'`
+ Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "first"
When I set env variable "ARUBA_TEST_VAR" to "second"
- And I run `ruby -e 'puts ENV[%q(ARUBA_TEST_VAR)]'`
- Then the output from "ruby -e 'puts ENV[%q(ARUBA_TEST_VAR)]'" should contain "second"
+ And I run `bash -c 'printf $ARUBA_TEST_VAR'`
+ Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "second"