aruba-jbb 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,7 @@
1
+ README.rdoc
2
+ lib/aruba/cucumber_steps.rb
3
+ lib/aruba/api.rb
4
+ lib/**/*.rb
5
+ bin/*
6
+ features/**/*.feature
7
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ tmp
data/History.txt ADDED
@@ -0,0 +1,75 @@
1
+ == 0.2.1
2
+
3
+ === Bugfixes
4
+ * Always compare with RSpec should =~ instead of should match. This gives a diff when there is no match. (Aslak Hellesøy)
5
+
6
+ == 0.2.0
7
+
8
+ === New Features
9
+ * Added aruba.gemspec. (David Chelimsky)
10
+
11
+ === Changed features
12
+ * Several step definitions regarding output have changed. (#1 Aslak Hellesøy)
13
+
14
+ - /^I should see "([^\"]*)"$/
15
+ + /^the output should contain "([^"]*)"$/
16
+
17
+ - /^I should not see "([^\"]*)"$/
18
+ + /^the output should not contain "([^"]*)"$/
19
+
20
+ - /^I should see:$/
21
+ + /^the output should contain:$/
22
+
23
+ - /^I should not see:$/
24
+ + /^the output should not contain:$/
25
+
26
+ - /^I should see exactly "([^\"]*)"$/
27
+ + /^the output should contain exactly "([^"]*)"$/
28
+
29
+ - /^I should see exactly:$/
30
+ + /^the output should contain exactly:$/
31
+
32
+ - /^I should see matching \/([^\/]*)\/$/
33
+ + /^the output should match \/([^\/]*)\/$/
34
+
35
+ - /^I should see matching:$/
36
+ + /^the output should match:$/
37
+
38
+ == 0.1.9
39
+ * If the GOTGEMS environment variable is set, bundler won't run (faster). (Aslak Hellesøy)
40
+
41
+ == 0.1.8
42
+ * Use // instead of "" for "I should see matching" step. (Aslak Hellesøy)
43
+ * Replace rvm gemset character '%' with '@' for rvm 0.1.24 (#5 Ashley Moran)
44
+ * Support gem bundler, making it easier to specify gems. (Aslak Hellesøy)
45
+
46
+ == 0.1.7
47
+ * New @announce-stderr tag (Robert Wahler)
48
+ * New "I should see matching" steps using Regexp (Robert Wahler)
49
+
50
+ == 0.1.6
51
+ * When /^I successfully run "(.*)"$/ now prints the combined output if exit status is not 0. (Aslak Hellesøy)
52
+ * Add bundle to list of common ruby scripts. (Aslak Hellesøy)
53
+
54
+ == 0.1.5
55
+ * Added ability to map rvm versions to a specific version with config/aruba-rvm.yml. (Aslak Hellesøy)
56
+ * Check for presence of files. (Aslak Hellesøy)
57
+ * Allow specification of rvm gemsets. (Aslak Hellesøy)
58
+ * Detect ruby commands and use current ruby when rvm is not explicitly used. (Aslak Hellesøy)
59
+ * Added support for rvm, making it possible to choose Ruby interpreter. (Aslak Hellesøy)
60
+ * Added @announce-cmd, @announce-stdout and @announce tags, useful for seeing what's executed and outputted. (Aslak Hellesøy)
61
+
62
+ == 0.1.4
63
+ * New step definition for appending to a file (Aslak Hellesøy)
64
+
65
+ == 0.1.3
66
+ * New step definition for cd (change directory) (Aslak Hellesøy)
67
+
68
+ == 0.1.2
69
+ * Separated API from Cucumber step definitions, makes this usable without Cucumber. (Aslak Hellesøy)
70
+
71
+ == 0.1.1
72
+ * Better Regexp escaping (David Chelimsky)
73
+
74
+ == 0.1.0
75
+ * First release (David Chelimsky and Aslak Hellesøy)
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Aslak Hellesøy, David Chelimsky
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,163 @@
1
+ = Aruba
2
+
3
+ aruba-jbb is a fork of http://github.com/aslakhellesoy/aruba
4
+
5
+ Aruba is a set of api methods and cucumber steps for driving out command
6
+ line applications. The command line application can be anything, a compiled
7
+ C program, a Java program, a Perl script - anything.
8
+
9
+ Aruba may also be used to test complex configuration files for third-party
10
+ applications where the software itself may not be modified.
11
+
12
+ Aruba provides support for testing using various Ruby versions (see below).
13
+
14
+ == Usage
15
+
16
+ gem install aruba-jbb
17
+
18
+ Then, just require the library in one of your Ruby files under
19
+ <tt>features/support</tt>
20
+
21
+ require 'aruba' # note that aruba-jbb and aruba cannot co-exist
22
+
23
+ You now have a bunch of step definitions that you can use in your features.
24
+ Look at aruba/cucumber_steps.rb to see all the step definitions. Look at
25
+ features/*.feature for examples (which are also testing Aruba itself).
26
+
27
+ You should be aware that Aruba runs the application it tests and creates
28
+ all local output in its own working directory (awd). The awd defaults to
29
+ <tt>tmp/aruba</tt> and is purged and created by Aruba at the beginning of
30
+ every Scenario. However, the contents created by the last Scenario
31
+ are left in the awd for your inspection.
32
+
33
+ If it is desired to alter the awd then this fork provides for setting the
34
+ working directory to something else via the ARUBA_WORKING_DIR environmental
35
+ variable. This must be set relative to the user's cwd.
36
+
37
+ This fork also contains a <tt>rebase</tt> api method which creates soft
38
+ (symbolic) links inside aruba's working directory to directories rooted
39
+ at the user's own current working directory (cwd). This permits the
40
+ application to find its configuation and support files in their usual
41
+ directories. A string of directories to rebase also may be passed by
42
+ setting the ARUBA_REBASE environmental variable. These must be set relative
43
+ to the user's cwd as well.
44
+
45
+ For example:
46
+
47
+ <tt>ARUBA_REBASE="bin,config,lib"</tt>
48
+
49
+ This will cause Aruba to create soft links called <tt>./tmp/aruba/bin</tt>,
50
+ <tt>./tmp/aruba/config</tt> and <tt>./tmp/aruba/lib</tt> each pointing
51
+ to the corresponding directory in the user's cwd.
52
+
53
+ This fork also provides support for a <tt>@no-aruba-tmpdir</tt> tag. Use of
54
+ this tag will cause Aruba to run the test application in the user's cwd
55
+ instead of the awd. When this tag is activated the directory contents are not
56
+ cleared, for obvious reasons. In fact, if the awd is set to anything outside
57
+ a directory tree containing a <tt>/tmp/</tt> portion then an error is raised
58
+ when trying to clear the contents. For similar reasons, when this is the case
59
+ the <tt>rebase</tt> method also raises an error.
60
+
61
+ == Ruby/RVM love
62
+
63
+ Aruba has a couple of step definitions that make it easier to test your
64
+ Ruby command line program with specific versions of Ruby (regardless of
65
+ what Ruby version you're using to invoke Cucumber).
66
+
67
+ This is done with the follwoing step definitions:
68
+
69
+ /^I am using rvm "([^"]*)"$/
70
+ /^I am using rvm gemset "([^"]*)"$/
71
+
72
+ Then, if you use the step definition:
73
+
74
+ /^I run "(.*)"$/
75
+
76
+ .. with a command that starts with <tt>ruby</tt>, Aruba will actually invoke
77
+ the Ruby version (and gemset if you specified) instead of just <tt>ruby</tt>,
78
+ which would be the one on your <tt>PATH</tt>, which might not be the one you
79
+ want. The same goes for commands starting with <tt>bundle</tt>,
80
+ <tt>cucumber</tt>, <tt>gem</tt>, <tt>jeweler</tt>, <tt>rails</tt>,
81
+ <tt>rake</tt>, <tt>rspec</tt> and <tt>spec</tt> -
82
+ they can all be run with a particular Ruby version that you specify.
83
+
84
+ See features/running_ruby.feature for examples.
85
+
86
+ == Getting more output with tags.
87
+
88
+ Aruba has several tags you can use to see what command actually gets run
89
+ (useful if you're using the RVM steps), STDOUT or STDERR. You can put these
90
+ tags on individual scenarios, or on a feature. The tags are:
91
+
92
+ * <tt>@announce-cmd</tt>
93
+ * <tt>@announce-stdout</tt>
94
+ * <tt>@announce-stderr</tt>
95
+ * <tt>@announce</tt> (does all of the above)
96
+
97
+ == Note on Patches/Pull Requests
98
+
99
+ * Fork the project.
100
+ * Make your feature addition or bug fix.
101
+ * Add tests for it. This is important so I don't break it in a
102
+ future version unintentionally.
103
+ * Commit, do not mess with rakefile, version, or history.
104
+ (if you want to have your own version, that is fine but bump
105
+ version in a commit by itself I can ignore when I pull)
106
+ * Send me a pull request. Bonus points for topic branches.
107
+
108
+ == Note on Aruba-JBB Step Definitions
109
+
110
+ This fork has extensively refactoried both the API and the Step
111
+ Definitions. There is some breakage with the step definitions
112
+ provided with the parent. Mostly these have to do with making
113
+ Aruba-jbb steps more specific so as to avoid anticipated collisions
114
+ with the user's own steps. On the other hand, most Aruba-jbb steps
115
+ are defined as sub strings so that the subject is no longer part of
116
+ the matcher. For example, instead of:
117
+
118
+ <tt>When /^I have a file named "([^\"]*)"$/ do |file|</tt>
119
+
120
+ This fork uses:
121
+
122
+ <tt>When /do have a file named "([^\"]*)"$/ do |file|</tt>
123
+
124
+ So in your features you can write this:
125
+
126
+ <tt> When I do have a file named "test"</tt>
127
+ . . .
128
+ <tt> When we do have a file named "test"</tt>
129
+ . . .
130
+ <tt> When they do have a file named "test"</tt>
131
+
132
+ == Note on Aruba-JBB Development Testing
133
+
134
+ This fork has not tested the JRuby features. It has also disabled
135
+ RCov in the Rake file and removed dependencies on beta versions of
136
+ RSpec.
137
+
138
+ There is a problem with loading Ruby libraries from rake which causes
139
+ Gherkin not to be found by Cucumber when Aruba features are exercised
140
+ using Rake (<tt>rake</tt> or <tt>rake cucumber</tt>). Nonetheless, all
141
+ features not using JRuby pass when exercised using <tt>cucumber features</tt>.
142
+
143
+ You can contact me at byrnejb@jharte-lyne.ca. I also monitor the
144
+ cukes@googlegroups.com mailing list.
145
+
146
+ == Note on Cucumber-Rails
147
+
148
+ I have renamed this gem since it has now evolved considerably away
149
+ from the baseline although, in the main, compatiblity between the
150
+ the two remains quite high. Nonetheless, to avoid collisions Aruba
151
+ must be removed (or uninstalled) if you wish to use Aruba-jbb.
152
+
153
+ However, Cucumber-Rails v0.3.2 has a dependency on Aruba which will
154
+ result in the Aruba baseline gem being installed whenever
155
+ Cucumber-Rails is installed or updated. Therefore the baseline Aruba
156
+ gem must be removed after updating Cucumber-Rails and the dependency
157
+ warning ignored.
158
+
159
+ == Copyright
160
+
161
+ Copyright (c) 2010 Aslak Hellesøy and David Chelimsky. See LICENSE for details.
162
+
163
+ Portions copyright (c) 2010 James B. Byrne. Released under the same LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,52 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'rubygems'
3
+ require 'rake'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.version = "0.2.2"
9
+ gem.name = "aruba-jbb"
10
+ gem.summary = %Q{CLI Steps for Cucumber}
11
+ gem.description = %Q{CLI Steps for Cucumber, hand-crafted for you in Aruba}
12
+ gem.email = "cukes@googlegroups.com"
13
+ gem.homepage = "http://github.com/byrnejb/aruba"
14
+ gem.authors = ["Aslak Hellesøy", "David Chelimsky", "James B. Byrne"]
15
+ gem.add_development_dependency "rspec", ">= 1.3.0"
16
+ gem.add_development_dependency "cucumber", ">= 0.8.3"
17
+ end
18
+ Jeweler::GemcutterTasks.new
19
+ rescue LoadError
20
+ puts "Jeweler (or a dependency) is not available. \n" +
21
+ " Install it with: gem install jeweler"
22
+ end
23
+
24
+ begin
25
+ require 'cucumber/rake/task'
26
+
27
+ Cucumber::Rake::Task.new do |t|
28
+ t.cucumber_opts = %w{--tags ~@jruby} unless defined?(JRUBY_VERSION)
29
+ t.rcov = false
30
+ end
31
+
32
+ task :cucumber => :check_dependencies
33
+ rescue LoadError
34
+ task :cucumber do
35
+ abort "Cucumber is not available. \n" +
36
+ " In order to run features, you must install it. \n" +
37
+ " gem install cucumber"
38
+ end
39
+ end
40
+
41
+ task :default => :cucumber
42
+
43
+ require 'rake/rdoctask'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "aruba-jbb #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/aruba/cucumber_steps.rb')
51
+ rdoc.rdoc_files.include('lib/**/*.rb')
52
+ end
data/aruba-jbb.gemspec ADDED
@@ -0,0 +1,60 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{aruba-jbb}
8
+ s.version = "0.2.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Aslak Helles\303\270y", "David Chelimsky", "James B. Byrne"]
12
+ s.date = %q{2010-07-23}
13
+ s.description = %q{CLI Steps for Cucumber, hand-crafted for you in Aruba}
14
+ s.email = %q{cukes@googlegroups.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "History.txt",
23
+ "LICENSE",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "aruba-jbb.gemspec",
27
+ "config/.gitignore",
28
+ "features/exit_statuses.feature",
29
+ "features/file_system_commands.feature",
30
+ "features/output.feature",
31
+ "features/running_ruby.feature",
32
+ "features/step_definitions/aruba_dev_steps.rb",
33
+ "features/support/env.rb",
34
+ "lib/aruba.rb",
35
+ "lib/aruba/api.rb",
36
+ "lib/aruba/cucumber_steps.rb"
37
+ ]
38
+ s.homepage = %q{http://github.com/byrnejb/aruba}
39
+ s.rdoc_options = ["--charset=UTF-8"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.7}
42
+ s.summary = %q{CLI Steps for Cucumber}
43
+
44
+ if s.respond_to? :specification_version then
45
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
+ s.specification_version = 3
47
+
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
+ s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
50
+ s.add_development_dependency(%q<cucumber>, [">= 0.8.3"])
51
+ else
52
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
53
+ s.add_dependency(%q<cucumber>, [">= 0.8.3"])
54
+ end
55
+ else
56
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
57
+ s.add_dependency(%q<cucumber>, [">= 0.8.3"])
58
+ end
59
+ end
60
+
data/config/.gitignore ADDED
@@ -0,0 +1 @@
1
+ aruba-rvm.yml
@@ -0,0 +1,21 @@
1
+ Feature: exit statuses
2
+
3
+ In order to specify expected exit statuses
4
+ As a developer using Cucumber
5
+ I want to use the "the exit status should be" step
6
+
7
+ Scenario: exit status of 0
8
+ When I run "ruby -h" without error
9
+ Then the exit status should be 0
10
+
11
+ Scenario: non-zero exit status
12
+ When I run "ruby -e 'exit 56'" with errors
13
+ Then the exit status should be 56
14
+ And the exit status should not be 0
15
+
16
+ Scenario: Successfully run something
17
+ When I run "ruby -e 'exit 0'" without error
18
+
19
+ Scenario: Unsuccessfully run something
20
+ When I do aruba I run "ruby -e 'exit 10'" without error step
21
+ Then aruba should fail with "Exit status was 10"
@@ -0,0 +1,115 @@
1
+ Feature: file system commands
2
+
3
+ In order to specify commands that load files
4
+ As a developer using Cucumber
5
+ I want to create temporary files
6
+
7
+ Scenario: create a dir
8
+ Given I do have a directory named "foo/bar"
9
+ When I run "ruby -e \"puts test ?d, 'foo'\""
10
+ Then the stdout should contain "true"
11
+
12
+ Scenario: create a file
13
+ Given I do have a file named "foo/bar/example.rb" with:
14
+ """
15
+ puts "hello world"
16
+ """
17
+ When I run "ruby foo/bar/example.rb"
18
+ Then the output should contain "hello world"
19
+
20
+ Scenario: append to a file
21
+ Given I do have a file named "foo/bar/example.rb" with:
22
+ """
23
+ puts "hello world"
24
+ """
25
+ When I append to "foo/bar/example.rb" with:
26
+ """
27
+ puts "this was appended"
28
+ """
29
+ When I run "ruby foo/bar/example.rb"
30
+ Then the output should contain "hello world"
31
+ And the output should contain "this was appended"
32
+
33
+ Scenario: clean up files generated in previous scenario
34
+ When I run "ruby foo/bar/example.rb"
35
+ Then the exit status should be 1
36
+ And the output should contain "No such file or directory -- foo/bar/example.rb"
37
+
38
+ Scenario: change to a subdir
39
+ Given I do have a file named "foo/bar/example.rb" with:
40
+ """
41
+ puts "hello world"
42
+ """
43
+ When I cd to "foo/bar"
44
+ And I run "ruby example.rb"
45
+ Then the output should contain "hello world"
46
+
47
+ Scenario: Reset current directory from previous scenario
48
+ When I run "ruby example.rb"
49
+ Then the exit status should be 1
50
+
51
+ Scenario: Holler if cd to bad dir
52
+ Given I do have a file named "foo/bar/example.rb" with:
53
+ """
54
+ puts "hello world"
55
+ """
56
+ When I do aruba I cd to "foo/nonexistant" step
57
+ Then aruba should fail with "tmp/aruba/foo/nonexistant is not a directory"
58
+
59
+ Scenario: Check for presence of a subset of files
60
+ Given I do have an empty file named "lorem/ipsum/dolor"
61
+ And I do have an empty file named "lorem/ipsum/sit"
62
+ And I do have an empty file named "lorem/ipsum/amet"
63
+ Then the following files should exist:
64
+ | lorem/ipsum/dolor |
65
+ | lorem/ipsum/amet |
66
+
67
+ Scenario: Check for absence of files
68
+ Then the following files should not exist:
69
+ | lorem/ipsum/dolor |
70
+
71
+ Scenario: Check for presence of a subset of directories
72
+ Given I do have a directory named "foo/bar"
73
+ And I do have a directory named "foo/bla"
74
+ Then the following directories should exist:
75
+ | foo/bar |
76
+ | foo/bla |
77
+
78
+ Scenario: Check file contents
79
+ Given I do have a file named "foo" with:
80
+ """
81
+ hello world
82
+ """
83
+ Then the file "foo" should contain "hello world"
84
+ And the file "foo" should not contain "HELLO WORLD"
85
+
86
+ Scenario: @aruba-tmpdir flag runs scenario in tmp/aruba
87
+ When I run "ruby -e \"require 'fileutils'; puts FileUtils.pwd\""
88
+ Then the stdout should contain "tmp/aruba"
89
+
90
+ @no-aruba-tmpdir
91
+ Scenario: @no-aruba-tmpdir runs scenario in cwd
92
+ When I run "ruby -e \"require 'fileutils'; puts FileUtils.pwd\""
93
+ Then the stdout should not contain "tmp/aruba"
94
+
95
+ @rebase-test @aruba-tmpdir @announce
96
+ Scenario: clean_up api checks for tmp directory subtree
97
+ Given the rebase-test before block conditions
98
+ When I cd to "../../testdata"
99
+ Then the clean_up api method should fail
100
+ And output should match /outside the tmp subtree and may not be deleted/
101
+
102
+
103
+ @rebase-test @aruba-tmpdir @announce
104
+ Scenario: @rebase-test tag creates soft links in aruba working directory
105
+ Given the rebase-test before block conditions
106
+ Then the soft links should exist in the aruba working directory
107
+
108
+
109
+ @rebase-test @aruba-tmpdir @announce
110
+ Scenario: rebase api creats soft links in aruba working directory
111
+ Given the rebase-test before block conditions
112
+ And I create the cwd sub-directory named "rebase_test"
113
+ When I rebase the directory named "rebase_test"
114
+ Then "rebase_test" should have a soft link in the aruba working directory
115
+ And I delete the cwd sub-directory named "rebase_test"
@@ -0,0 +1,96 @@
1
+ Feature: Output
2
+
3
+ In order to specify expected output
4
+ As a developer using Cucumber
5
+ I want to use the "the output should contain" step
6
+
7
+ Scenario: Run unknown command
8
+ When I run "neverever gonna work"
9
+ Then the output should contain:
10
+ """
11
+ sh: neverever: command not found
12
+ """
13
+
14
+ Scenario: Detect subset of one-line output
15
+ When I run "ruby -e 'puts \"hello world\"'"
16
+ Then the output should contain "hello world"
17
+
18
+ Scenario: Detect subset of one-line output
19
+ When I run "echo 'hello world'"
20
+ Then the output should contain "hello world"
21
+
22
+ Scenario: Detect absence of one-line output
23
+ When I run "ruby -e 'puts \"hello world\"'"
24
+ Then the output should not contain "good-bye"
25
+
26
+ Scenario: Detect subset of multiline output
27
+ When I run "ruby -e 'puts \"hello\\nworld\"'"
28
+ Then the output should contain:
29
+ """
30
+ hello
31
+ """
32
+
33
+ Scenario: Detect subset of multiline output
34
+ When I run "ruby -e 'puts \"hello\\nworld\"'"
35
+ Then the output should not contain:
36
+ """
37
+ good-bye
38
+ """
39
+
40
+ Scenario: Detect exact one-line output
41
+ When I run "ruby -e 'puts \"hello world\"'"
42
+ Then the output should contain exactly "hello world\n"
43
+
44
+ Scenario: Detect exact multiline output
45
+ When I run "ruby -e 'puts \"hello\\nworld\"'"
46
+ Then the output should contain exactly:
47
+ """
48
+ hello
49
+ world
50
+
51
+ """
52
+
53
+ @announce
54
+ Scenario: Detect subset of one-line output with regex
55
+ When I run "ruby --version"
56
+ Then the output should contain "ruby"
57
+ And the output should match /ruby ([\d]+\.[\d]+\.[\d]+)(p\d+)? \(.*$/
58
+
59
+ @announce
60
+ Scenario: Detect subset of multiline output with regex
61
+ When I run "ruby -e 'puts \"hello\\nworld\\nextra line1\\nextra line2\\nimportant line\"'"
62
+ Then the output should match:
63
+ """
64
+ he..o
65
+ wor.d
66
+ .*
67
+ important line
68
+ """
69
+
70
+ @announce
71
+ Scenario: Match passing exit status and partial output
72
+ When I run "ruby -e 'puts \"hello\\nworld\"'"
73
+ Then it should pass with:
74
+ """
75
+ hello
76
+ """
77
+
78
+ @announce-stdout
79
+ Scenario: Match failing exit status and partial output
80
+ When I run "ruby -e 'puts \"hello\\nworld\";exit 99'"
81
+ Then it should fail with:
82
+ """
83
+ hello
84
+ """
85
+
86
+ @announce-cmd
87
+ Scenario: Match output in stdout
88
+ When I run "ruby -e 'puts \"hello\\nworld\"'"
89
+ Then the stdout should contain "hello"
90
+ Then the stderr should not contain "hello"
91
+
92
+ @announce-stderr
93
+ Scenario: Match output in stderr
94
+ When I run "ruby -e 'STDERR.puts \"hello\\nworld\";exit 99'"
95
+ Then the stderr should contain "hello"
96
+ Then the stdout should not contain "hello"