aruba 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
22
  tmp
23
+ *.gemspec
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.1.7
2
+ * New @announce-stderr tag (Robert Wahler)
3
+ * New "I should see matching" steps using Regexp (Robert Wahler)
4
+
1
5
  == 0.1.6
2
6
  * When /^I successfully run "(.*)"$/ now prints the combined output if exit status is not 0. (Aslak Hellesøy)
3
7
  * Add bundle to list of common ruby scripts. (Aslak Hellesøy)
data/README.rdoc CHANGED
@@ -1,6 +1,8 @@
1
1
  = aruba
2
2
 
3
- Cucumber steps for driving out command line applications.
3
+ Cucumber steps for driving out command line applications. The command line application can be anything,
4
+ a compiled C program, a Java program, a Perl script - anything. There is also special support for various
5
+ Ruby versions (see below).
4
6
 
5
7
  == Usage
6
8
 
@@ -10,8 +12,41 @@ Then, just require the library in one of your ruby files under <tt>features/supp
10
12
 
11
13
  require 'aruba'
12
14
 
13
- You now have a bunch of step definitions that you can use in your features. See aruba.rb
14
- for details.
15
+ You now have a bunch of step definitions that you can use in your features. Look at aruba/cucumber.rb
16
+ to see all the step definitions. Look at features/*.feature for examples (which are also testing Aruba
17
+ itself).
18
+
19
+ == Ruby/RVM love
20
+
21
+ Aruba has a couple of step definitions that make it easier to test your ruby command line program
22
+ with specific versions of Ruby (regardless of what Ruby version you're using to invoke Cucumber).
23
+
24
+ This is done with the follwoing step definitions:
25
+
26
+ /^I am using rvm "([^\"]*)"$/
27
+ /^I am using rvm gemset "([^\"]*)"$/
28
+
29
+ Then, if you use the step definition:
30
+
31
+ /^I run "(.*)"$/
32
+
33
+ .. with a command that starts with <tt>ruby</tt>, Aruba will actually invoke the Ruby version (and gemset
34
+ if you specified) instead of just <tt>ruby</tt>, which would be the one on your <tt>PATH</tt>, which might
35
+ not be the one you want. The same goes for commands starting with <tt>bundle</tt>,
36
+ <tt>cucumber</tt>, <tt>gem</tt>, <tt>jeweler</tt>, <tt>rails</tt>, <tt>rake</tt>, <tt>rspec</tt> and <tt>spec</tt> -
37
+ they can all be run with a particular ruby version that you specify.
38
+
39
+ See features/running_ruby.feature for examples.
40
+
41
+ == Getting more output with tags.
42
+
43
+ Aruba has several tags you can use to see what command actually gets run (useful if you're using the RVM steps),
44
+ STDOUT or STDERR. You can put these tags on individual scenarios, or on a feature. The tags are:
45
+
46
+ * <tt>@announce-cmd</tt>
47
+ * <tt>@announce-stdout</tt>
48
+ * <tt>@announce-stderr</tt>
49
+ * <tt>@announce</tt> (does all of the above)
15
50
 
16
51
  == Note on Patches/Pull Requests
17
52
 
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake'
5
5
  begin
6
6
  require 'jeweler'
7
7
  Jeweler::Tasks.new do |gem|
8
- gem.version = "0.1.6"
8
+ gem.version = "0.1.7"
9
9
  gem.name = "aruba"
10
10
  gem.summary = %Q{CLI Steps for Cucumber}
11
11
  gem.description = %Q{CLI Steps for Cucumber, hand-crafted for you in Aruba}
@@ -43,6 +43,23 @@ Feature: Output
43
43
 
44
44
  """
45
45
 
46
+ @announce
47
+ Scenario: Detect subset of one-line output with regex
48
+ When I run "ruby --version"
49
+ Then I should see "ruby"
50
+ And I should see matching "ruby ([\d]+\.[\d]+\.[\d]+) \(.*$"
51
+
52
+ @announce
53
+ Scenario: Detect subset of multiline output with regex
54
+ When I run "ruby -e 'puts \"hello\\nworld\\nextra line1\\nextra line2\\nimportant line\"'"
55
+ Then I should see matching:
56
+ """
57
+ he..o
58
+ wor.d
59
+ .*
60
+ important line
61
+ """
62
+
46
63
  @announce
47
64
  Scenario: Match passing exit status and partial output
48
65
  When I run "ruby -e 'puts \"hello\\nworld\"'"
@@ -65,6 +82,7 @@ Feature: Output
65
82
  Then the stdout should contain "hello"
66
83
  Then the stderr should not contain "hello"
67
84
 
85
+ @announce-stderr
68
86
  Scenario: Match output in stderr
69
87
  When I run "ruby -e 'STDERR.puts \"hello\\nworld\";exit 99'"
70
88
  Then the stderr should contain "hello"
data/lib/aruba/api.rb CHANGED
@@ -111,6 +111,9 @@ module Api
111
111
  @last_exit_status = $?.exitstatus
112
112
  end
113
113
  @last_stderr = IO.read(stderr_file.path)
114
+
115
+ announce(@last_stderr) if @announce_stderr
116
+ @last_stderr
114
117
  end
115
118
 
116
119
  def detect_ruby(cmd)
@@ -14,8 +14,13 @@ Before('@announce-stdout') do
14
14
  @announce_stdout = true
15
15
  end
16
16
 
17
+ Before('@announce-stderr') do
18
+ @announce_stderr = true
19
+ end
20
+
17
21
  Before('@announce') do
18
22
  @announce_stdout = true
23
+ @announce_stderr = true
19
24
  @announce_cmd = true
20
25
  end
21
26
 
@@ -82,6 +87,18 @@ Then /^I should see exactly:$/ do |exact_output|
82
87
  combined_output.should == exact_output
83
88
  end
84
89
 
90
+ # "I should see matching" allows regex in the partial_output, if
91
+ # you don't need regex, use "I should see" instead since
92
+ # that way, you don't have to escape regex characters that
93
+ # appear naturally in the output
94
+ Then /^I should see matching "([^\"]*)"$/ do |partial_output|
95
+ combined_output.should =~ /#{partial_output}/
96
+ end
97
+
98
+ Then /^I should see matching:$/ do |partial_output|
99
+ combined_output.should =~ /#{partial_output}/m
100
+ end
101
+
85
102
  Then /^the exit status should be (\d+)$/ do |exit_status|
86
103
  @last_exit_status.should == exit_status.to_i
87
104
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Aslak Helles\xC3\xB8y"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-02-26 00:00:00 +01:00
18
+ date: 2010-03-05 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -62,7 +62,6 @@ files:
62
62
  - LICENSE
63
63
  - README.rdoc
64
64
  - Rakefile
65
- - aruba.gemspec
66
65
  - config/.gitignore
67
66
  - features/exit_statuses.feature
68
67
  - features/file_system_commands.feature
data/aruba.gemspec DELETED
@@ -1,60 +0,0 @@
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}
8
- s.version = "0.1.6"
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"]
12
- s.date = %q{2010-02-26}
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.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.rb"
37
- ]
38
- s.homepage = %q{http://github.com/aslakhellesoy/aruba}
39
- s.rdoc_options = ["--charset=UTF-8"]
40
- s.require_paths = ["lib"]
41
- s.rubygems_version = %q{1.3.6}
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::RubyGemsVersion) >= 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.6.2"])
51
- else
52
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
53
- s.add_dependency(%q<cucumber>, [">= 0.6.2"])
54
- end
55
- else
56
- s.add_dependency(%q<rspec>, [">= 1.3.0"])
57
- s.add_dependency(%q<cucumber>, [">= 0.6.2"])
58
- end
59
- end
60
-