cucumber 0.3.100 → 0.3.101

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,15 @@
1
+ == In Git
2
+
3
+ Step Argument Transforms
4
+
5
+ === New Features
6
+ * New pdf formatter (#425 Mads Buus)
7
+ * Step Argument Transforms: These let you use the Transform method to register regular expressions
8
+ to catch and transform/coerce arguments before they are yielded to step definitions:
9
+ http://wiki.github.com/aslakhellesoy/cucumber/step-argument-transforms (Larry Diehl & Dave Astels)
10
+ * Adding webrat steps for asserting content does or does not exist within a particular element
11
+ (using webrat's within method) (Kieran Pilkington)
12
+
1
13
  == 0.3.100 2009-09-09
2
14
 
3
15
  The JavaZone release!
@@ -211,6 +211,7 @@ examples/self_test/features/step_definitions/sample_steps.rb
211
211
  examples/self_test/features/support/env.rb
212
212
  examples/self_test/features/tags_sample.feature
213
213
  examples/self_test/features/tons_of_cukes.feature
214
+ examples/self_test/features/transform_sample.feature
214
215
  examples/self_test/features/undefined_multiline_args.feature
215
216
  examples/self_test/list-of-features.txt
216
217
  examples/sinatra/README.textile
@@ -289,6 +290,7 @@ features/step_definitions/extra_steps.rb
289
290
  features/steps_formatter.feature
290
291
  features/support/env.rb
291
292
  features/table_diffing.feature
293
+ features/transform.feature
292
294
  features/unicode_table.feature
293
295
  features/usage.feature
294
296
  features/work_in_progress.feature
@@ -349,6 +351,7 @@ lib/cucumber/formatter/duration.rb
349
351
  lib/cucumber/formatter/html.rb
350
352
  lib/cucumber/formatter/junit.rb
351
353
  lib/cucumber/formatter/ordered_xml_markup.rb
354
+ lib/cucumber/formatter/pdf.rb
352
355
  lib/cucumber/formatter/pretty.rb
353
356
  lib/cucumber/formatter/profile.rb
354
357
  lib/cucumber/formatter/progress.rb
@@ -79,3 +79,15 @@ After('@after_file') do
79
79
  FileUtils.mkdir_p(File.dirname(after_file))
80
80
  FileUtils.touch(after_file)
81
81
  end
82
+
83
+ Then /^I should transform ('\d+' to an Integer)$/ do |integer|
84
+ integer.should be_kind_of(Integer)
85
+ end
86
+
87
+ Then /^I should transform ('\w+' to a Symbol)$/ do |symbol|
88
+ symbol.should be_kind_of(Symbol)
89
+ end
90
+
91
+ Then /^I should not transform ('\d+') to an Integer$/ do |string|
92
+ string.should be_kind_of(String)
93
+ end
@@ -16,3 +16,9 @@ end
16
16
  After('@background_tagged_before_on_outline') do
17
17
  @cukes.should == '888'
18
18
  end
19
+
20
+ Transform /^'\d+' to an Integer$/ do |step_arg|
21
+ /'(\d+)' to an Integer/.match(step_arg)[0].to_i
22
+ end
23
+
24
+ Transform(/^('\w+') to a Symbol$/) {|str| str.to_sym }
@@ -0,0 +1,10 @@
1
+ Feature: Step argument transformations
2
+
3
+ Scenario: transform with matches
4
+ Then I should transform '10' to an Integer
5
+
6
+ Scenario: transform with matches that capture
7
+ Then I should transform 'abc' to a Symbol
8
+
9
+ Scenario: transform without matches
10
+ Then I should not transform '10' to an Integer
@@ -351,6 +351,17 @@ Feature: Cucumber command line
351
351
  Scenario: Skipped
352
352
  Given missing
353
353
 
354
+ Feature: Step argument transformations
355
+
356
+ Scenario: transform with matches
357
+ Then I should transform '10' to an Integer
358
+
359
+ Scenario: transform with matches that capture
360
+ Then I should transform 'abc' to a Symbol
361
+
362
+ Scenario: transform without matches
363
+ Then I should not transform '10' to an Integer
364
+
354
365
  Feature: undefined multiline args
355
366
 
356
367
  Scenario: pystring
@@ -364,8 +375,8 @@ Feature: Cucumber command line
364
375
  | table |
365
376
  | example |
366
377
 
367
- 26 scenarios (17 skipped, 8 undefined, 1 passed)
368
- 42 steps (30 skipped, 12 undefined)
378
+ 29 scenarios (20 skipped, 8 undefined, 1 passed)
379
+ 45 steps (33 skipped, 12 undefined)
369
380
 
370
381
  """
371
382
 
@@ -620,6 +631,10 @@ Feature: Cucumber command line
620
631
 
621
632
  """
622
633
 
634
+ Scenario: Generate PDF with pdf formatter
635
+ When I run cucumber --format pdf --out tmp/sample.pdf --dry-run features/sample.feature
636
+ Then "examples/self_test/tmp/sample.pdf" should match "Pages 2"
637
+
623
638
  Scenario: Run feature elements which match a name using -n
624
639
  When I run cucumber -n Pisang -q features/
625
640
  Then it should pass with
@@ -142,12 +142,12 @@ features/background/failing_background_after_success.feature:5:in `And '10' glob
142
142
  features/background/scenario_outline_failing_background.feature:4:in `Given failing without a table'</pre></li></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">failing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_failing_background_feature_7"><div><span class="keyword">Then</span> <span class="step val">I should have '&lt;count&gt;' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_9"><th class="val skipped_param" id="row_9_0">count</th></tr><tr id="row_10"><td class="val skipped" id="row_10_0">10</td></tr><tr><td class="failed" colspan="1"><pre>FAIL (RuntimeError)
143
143
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
144
144
  ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
145
- features/background/scenario_outline_failing_background.feature:4:in `Given failing without a table'</pre></td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">another failing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_failing_background_feature_13"><div><span class="keyword">Then</span> <span class="step val">I should have '&lt;count&gt;' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_15"><th class="val skipped_param" id="row_15_0">count</th></tr><tr id="row_16"><td class="val skipped" id="row_16_0">10</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Passing background with scenario outlines sample</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step passed" id="features_background_scenario_outline_passing_background_feature_4"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">10</span>' cukes</span></div></li></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">passing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_passing_background_feature_7"><div><span class="keyword">Then</span> <span class="step val">I should have '&lt;count&gt;' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_9"><th class="val skipped_param" id="row_9_0">count</th></tr><tr id="row_10"><td class="val passed" id="row_10_0">10</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">another passing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_passing_background_feature_13"><div><span class="keyword">Then</span> <span class="step val">I should have '&lt;count&gt;' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_15"><th class="val skipped_param" id="row_15_0">count</th></tr><tr id="row_16"><td class="val passed" id="row_16_0">10</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Calling undefined step</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Call directly</span></h3><ol><li class="step undefined" id="features_call_undefined_step_from_step_def_feature_4"><div><span class="keyword">Given</span> <span class="step val">a step definition that calls an undefined step</span></div><pre class="undefined">Undefined step: "this does not exist" (Cucumber::Undefined)
145
+ features/background/scenario_outline_failing_background.feature:4:in `Given failing without a table'</pre></td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">another failing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_failing_background_feature_13"><div><span class="keyword">Then</span> <span class="step val">I should have '&lt;count&gt;' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_15"><th class="val skipped_param" id="row_15_0">count</th></tr><tr id="row_16"><td class="val skipped" id="row_16_0">10</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Passing background with scenario outlines sample</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step passed" id="features_background_scenario_outline_passing_background_feature_4"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">10</span>' cukes</span></div></li></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">passing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_passing_background_feature_7"><div><span class="keyword">Then</span> <span class="step val">I should have '&lt;count&gt;' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_9"><th class="val skipped_param" id="row_9_0">count</th></tr><tr id="row_10"><td class="val passed" id="row_10_0">10</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">another passing background</span></h3><ol><li class="step skipped" id="features_background_scenario_outline_passing_background_feature_13"><div><span class="keyword">Then</span> <span class="step val">I should have '&lt;count&gt;' cukes</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_15"><th class="val skipped_param" id="row_15_0">count</th></tr><tr id="row_16"><td class="val passed" id="row_16_0">10</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Calling undefined step</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Call directly</span></h3><ol><li class="step undefined" id="features_call_undefined_step_from_step_def_feature_4"><div><span class="keyword">Given</span> <span class="step val">a step definition that calls an undefined step</span></div><pre class="undefined">Undefined step: &amp;quot;this does not exist&amp;quot; (Cucumber::Undefined)
146
146
  ./features/step_definitions/sample_steps.rb:20:in `/^a step definition that calls an undefined step$/'
147
- features/call_undefined_step_from_step_def.feature:4:in `Given a step definition that calls an undefined step'</pre></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Call via another</span></h3><ol><li class="step undefined" id="features_call_undefined_step_from_step_def_feature_7"><div><span class="keyword">Given</span> <span class="step val">call step &quot;<span class="param">a step definition that calls an undefined step</span>&quot;</span></div><pre class="undefined">Undefined step: "this does not exist" (Cucumber::Undefined)
147
+ features/call_undefined_step_from_step_def.feature:4:in `Given a step definition that calls an undefined step'</pre></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Call via another</span></h3><ol><li class="step undefined" id="features_call_undefined_step_from_step_def_feature_7"><div><span class="keyword">Given</span> <span class="step val">call step &quot;<span class="param">a step definition that calls an undefined step</span>&quot;</span></div><pre class="undefined">Undefined step: &amp;quot;this does not exist&amp;quot; (Cucumber::Undefined)
148
148
  ./features/step_definitions/sample_steps.rb:20:in `/^a step definition that calls an undefined step$/'
149
- features/call_undefined_step_from_step_def.feature:7:in `Given call step "a step definition that calls an undefined step"'</pre></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Failing expectation</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Failing expectation</span></h3><ol><li class="step failed" id="features_failing_expectation_feature_4"><div><span class="keyword">Given</span> <span class="step val">failing expectation</span></div><pre class="failed">expected: "that",
150
- got: "this" (using ==)
149
+ features/call_undefined_step_from_step_def.feature:7:in `Given call step &amp;quot;a step definition that calls an undefined step&amp;quot;'</pre></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Failing expectation</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Failing expectation</span></h3><ol><li class="step failed" id="features_failing_expectation_feature_4"><div><span class="keyword">Given</span> <span class="step val">failing expectation</span></div><pre class="failed">expected: &amp;quot;that&amp;quot;,
150
+ got: &amp;quot;this&amp;quot; (using ==)
151
151
 
152
152
  Diff:
153
153
  @@ -1,2 +1,2 @@
@@ -166,7 +166,7 @@ which goes on and on and on for three lines
166
166
  yawn</span></h4><table><tr id="row_26"><th class="val skipped_param" id="row_26_0">state</th></tr><tr id="row_27"><td class="val passed" id="row_27_0">passing</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Outline Sample</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">I have no steps</span></h3><ol></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Test state</span></h3><ol><li class="step skipped" id="features_outline_sample_feature_6"><div><span class="keyword">Given</span> <span class="step val">&lt;state&gt; without a table</span></div></li><li class="step skipped" id="features_outline_sample_feature_7"><div><span class="keyword">Given</span> <span class="step val">&lt;other_state&gt; without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Rainbow colours</span></h4><table><tr id="row_9"><th class="val skipped_param" id="row_9_0">state</th><th class="val skipped_param" id="row_9_1">other_state</th></tr><tr id="row_10"><td class="val undefined" id="row_10_0">missing</td><td class="val skipped" id="row_10_1">passing</td></tr><tr id="row_11"><td class="val passed" id="row_11_0">passing</td><td class="val passed" id="row_11_1">passing</td></tr><tr id="row_12"><td class="val failed" id="row_12_0">failing</td><td class="val skipped" id="row_12_1">passing</td></tr><tr><td class="failed" colspan="2"><pre>FAIL (RuntimeError)
167
167
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
168
168
  ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
169
- features/outline_sample.feature:6:in `Given <state> without a table'</pre></td></tr></table></div><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Only passing</span></h4><table><tr id="row_14"><th class="val skipped_param" id="row_14_0">state</th><th class="val skipped_param" id="row_14_1">other_state</th></tr><tr id="row_15"><td class="val passed" id="row_15_0">passing</td><td class="val passed" id="row_15_1">passing</td></tr></table></div></div></div><div class="feature"><pre class="comment"># Feature comment<br/></pre><span class="tag">@one</span><h2><span class="val">Feature: Sample</span></h2><p class="narrative"></p><div class="scenario"><span class="tag">@two</span> <span class="tag">@three</span><h3><span class="keyword">Scenario:</span> <span class="val">Missing</span></h3><ol><li class="step undefined" id="features_sample_feature_7"><div><span class="keyword">Given</span> <span class="step val">missing</span></div></li></ol></div><div class="scenario"><pre class="comment"># Scenario comment<br/></pre><span class="tag">@three</span><h3><span class="keyword">Scenario:</span> <span class="val">Passing</span></h3><ol><li class="step passed" id="features_sample_feature_12"><div><span class="keyword">Given</span> <span class="step val">passing</span></div><table><tr id="row_13"><td class="val" id="row_13_0">a</td><td class="val" id="row_13_1">b</td></tr><tr id="row_14"><td class="val" id="row_14_0">c</td><td class="val" id="row_14_1">d</td></tr></table></li></ol></div><div class="scenario"><span class="tag">@four</span><h3><span class="keyword">Scenario:</span> <span class="val">Failing</span></h3><ol><li class="step failed" id="features_sample_feature_18"><div><span class="keyword">Given</span> <span class="step val">failing</span></div><pre class="val">hello</pre><pre class="failed">FAIL (RuntimeError)
169
+ features/outline_sample.feature:6:in `Given &lt;state&gt; without a table'</pre></td></tr></table></div><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Only passing</span></h4><table><tr id="row_14"><th class="val skipped_param" id="row_14_0">state</th><th class="val skipped_param" id="row_14_1">other_state</th></tr><tr id="row_15"><td class="val passed" id="row_15_0">passing</td><td class="val passed" id="row_15_1">passing</td></tr></table></div></div></div><div class="feature"><pre class="comment"># Feature comment<br/></pre><span class="tag">@one</span><h2><span class="val">Feature: Sample</span></h2><p class="narrative"></p><div class="scenario"><span class="tag">@two</span> <span class="tag">@three</span><h3><span class="keyword">Scenario:</span> <span class="val">Missing</span></h3><ol><li class="step undefined" id="features_sample_feature_7"><div><span class="keyword">Given</span> <span class="step val">missing</span></div></li></ol></div><div class="scenario"><pre class="comment"># Scenario comment<br/></pre><span class="tag">@three</span><h3><span class="keyword">Scenario:</span> <span class="val">Passing</span></h3><ol><li class="step passed" id="features_sample_feature_12"><div><span class="keyword">Given</span> <span class="step val">passing</span></div><table><tr id="row_13"><td class="val" id="row_13_0">a</td><td class="val" id="row_13_1">b</td></tr><tr id="row_14"><td class="val" id="row_14_0">c</td><td class="val" id="row_14_1">d</td></tr></table></li></ol></div><div class="scenario"><span class="tag">@four</span><h3><span class="keyword">Scenario:</span> <span class="val">Failing</span></h3><ol><li class="step failed" id="features_sample_feature_18"><div><span class="keyword">Given</span> <span class="step val">failing</span></div><pre class="val">hello</pre><pre class="failed">FAIL (RuntimeError)
170
170
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
171
171
  ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
172
172
  features/sample.feature:18:in `Given failing'</pre></li></ol></div></div><div class="feature"><h2><span class="val">Feature: search examples</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val">Hantu Pisang background match</span></h3><ol><li class="step passed" id="features_search_sample_feature_4"><div><span class="keyword">Given</span> <span class="step val">passing without a table</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">should match Hantu Pisang</span></h3><ol><li class="step passed" id="features_search_sample_feature_7"><div><span class="keyword">Given</span> <span class="step val">passing without a table</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Ignore me</span></h3><ol><li class="step failed" id="features_search_sample_feature_10"><div><span class="keyword">Given</span> <span class="step val">failing without a table</span></div><pre class="failed">FAIL (RuntimeError)
@@ -175,9 +175,9 @@ features/sample.feature:18:in `Given failing'</pre></li></ol></div></div><div cl
175
175
  features/search_sample.feature:10:in `Given failing without a table'</pre></li></ol></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Ignore me</span></h3><ol><li class="step skipped" id="features_search_sample_feature_13"><div><span class="keyword">Given</span> <span class="step val">&lt;state&gt; without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_15"><th class="val skipped_param" id="row_15_0">state</th></tr><tr id="row_16"><td class="val failed" id="row_16_0">failing</td></tr><tr><td class="failed" colspan="1"><pre>FAIL (RuntimeError)
176
176
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
177
177
  ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
178
- features/search_sample.feature:13:in `Given <state> without a table'</pre></td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Hantu Pisang match</span></h3><ol><li class="step skipped" id="features_search_sample_feature_19"><div><span class="keyword">Given</span> <span class="step val">&lt;state&gt; without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_21"><th class="val skipped_param" id="row_21_0">state</th></tr><tr id="row_22"><td class="val passed" id="row_22_0">passing</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">no match in name but in examples</span></h3><ol><li class="step skipped" id="features_search_sample_feature_25"><div><span class="keyword">Given</span> <span class="step val">&lt;state&gt; without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Hantu Pisang</span></h4><table><tr id="row_27"><th class="val skipped_param" id="row_27_0">state</th></tr><tr id="row_28"><td class="val passed" id="row_28_0">passing</td></tr></table></div><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Ignore me</span></h4><table><tr id="row_31"><th class="val skipped_param" id="row_31_0">state</th></tr><tr id="row_32"><td class="val failed" id="row_32_0">failing</td></tr><tr><td class="failed" colspan="1"><pre>FAIL (RuntimeError)
178
+ features/search_sample.feature:13:in `Given &lt;state&gt; without a table'</pre></td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">Hantu Pisang match</span></h3><ol><li class="step skipped" id="features_search_sample_feature_19"><div><span class="keyword">Given</span> <span class="step val">&lt;state&gt; without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_21"><th class="val skipped_param" id="row_21_0">state</th></tr><tr id="row_22"><td class="val passed" id="row_22_0">passing</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">no match in name but in examples</span></h3><ol><li class="step skipped" id="features_search_sample_feature_25"><div><span class="keyword">Given</span> <span class="step val">&lt;state&gt; without a table</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Hantu Pisang</span></h4><table><tr id="row_27"><th class="val skipped_param" id="row_27_0">state</th></tr><tr id="row_28"><td class="val passed" id="row_28_0">passing</td></tr></table></div><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Ignore me</span></h4><table><tr id="row_31"><th class="val skipped_param" id="row_31_0">state</th></tr><tr id="row_32"><td class="val failed" id="row_32_0">failing</td></tr><tr><td class="failed" colspan="1"><pre>FAIL (RuntimeError)
179
179
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
180
180
  ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
181
- features/search_sample.feature:25:in `Given <state> without a table'</pre></td></tr></table></div></div></div><div class="feature"><span class="tag">@sample_one</span><h2><span class="val">Feature: Tag samples</span></h2><p class="narrative"></p><div class="scenario"><span class="tag">@sample_two</span> <span class="tag">@sample_four</span><h3><span class="keyword">Scenario:</span> <span class="val">Passing</span></h3><ol><li class="step undefined" id="features_tags_sample_feature_6"><div><span class="keyword">Given</span> <span class="step val">missing</span></div></li></ol></div><div class="scenario outline"><span class="tag">@sample_three</span><h3><span class="keyword">Scenario Outline:</span> <span class="val"></span></h3><ol><li class="step skipped" id="features_tags_sample_feature_10"><div><span class="keyword">Given</span> <span class="step val">&lt;state&gt;</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_12"><th class="val skipped_param" id="row_12_0">state</th></tr><tr id="row_13"><td class="val undefined" id="row_13_0">missing</td></tr></table></div></div><div class="scenario"><span class="tag">@sample_three</span> <span class="tag">@sample_four</span><h3><span class="keyword">Scenario:</span> <span class="val">Skipped</span></h3><ol><li class="step undefined" id="features_tags_sample_feature_17"><div><span class="keyword">Given</span> <span class="step val">missing</span></div></li></ol></div></div><div class="feature"><span class="tag">@lots</span><h2><span class="val">Feature: Tons of cukes</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Lots and lots</span></h3><ol><li class="step passed" id="features_tons_of_cukes_feature_4"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step failed" id="features_tons_of_cukes_feature_5"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div><pre class="failed">We already have 2 cukes! (RuntimeError)
181
+ features/search_sample.feature:25:in `Given &lt;state&gt; without a table'</pre></td></tr></table></div></div></div><div class="feature"><span class="tag">@sample_one</span><h2><span class="val">Feature: Tag samples</span></h2><p class="narrative"></p><div class="scenario"><span class="tag">@sample_two</span> <span class="tag">@sample_four</span><h3><span class="keyword">Scenario:</span> <span class="val">Passing</span></h3><ol><li class="step undefined" id="features_tags_sample_feature_6"><div><span class="keyword">Given</span> <span class="step val">missing</span></div></li></ol></div><div class="scenario outline"><span class="tag">@sample_three</span><h3><span class="keyword">Scenario Outline:</span> <span class="val"></span></h3><ol><li class="step skipped" id="features_tags_sample_feature_10"><div><span class="keyword">Given</span> <span class="step val">&lt;state&gt;</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_12"><th class="val skipped_param" id="row_12_0">state</th></tr><tr id="row_13"><td class="val undefined" id="row_13_0">missing</td></tr></table></div></div><div class="scenario"><span class="tag">@sample_three</span> <span class="tag">@sample_four</span><h3><span class="keyword">Scenario:</span> <span class="val">Skipped</span></h3><ol><li class="step undefined" id="features_tags_sample_feature_17"><div><span class="keyword">Given</span> <span class="step val">missing</span></div></li></ol></div></div><div class="feature"><span class="tag">@lots</span><h2><span class="val">Feature: Tons of cukes</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Lots and lots</span></h3><ol><li class="step passed" id="features_tons_of_cukes_feature_4"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step failed" id="features_tons_of_cukes_feature_5"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div><pre class="failed">We already have 2 cukes! (RuntimeError)
182
182
  ./features/step_definitions/sample_steps.rb:28:in `/^'(.+)' cukes$/'
183
- features/tons_of_cukes.feature:5:in `Given '2' cukes'</pre></li><li class="step skipped" id="features_tons_of_cukes_feature_6"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_7"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_8"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_9"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_10"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_11"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_12"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_13"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_14"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_15"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_16"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_17"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_18"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_19"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_20"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_21"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_22"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_23"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_24"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_25"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_26"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_27"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_28"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_29"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_30"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_31"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_32"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_33"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_34"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_35"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_36"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_37"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_38"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_39"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_40"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_41"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_42"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_43"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_44"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_45"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_46"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_47"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_48"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_49"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_50"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_51"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_52"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: undefined multiline args</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">pystring</span></h3><ol><li class="step undefined" id="features_undefined_multiline_args_feature_4"><div><span class="keyword">Given</span> <span class="step val">a pystring</span></div><pre class="val"> example</pre></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">table</span></h3><ol><li class="step undefined" id="features_undefined_multiline_args_feature_10"><div><span class="keyword">Given</span> <span class="step val">a table</span></div><table><tr id="row_11"><td class="val" id="row_11_0">table</td></tr><tr id="row_12"><td class="val" id="row_12_0">example</td></tr></table></li></ol></div></div><div class="duration">0m30.005s</div></div></body></html>
183
+ features/tons_of_cukes.feature:5:in `Given '2' cukes'</pre></li><li class="step skipped" id="features_tons_of_cukes_feature_6"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_7"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_8"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_9"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_10"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_11"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_12"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_13"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_14"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_15"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_16"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_17"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_18"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_19"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_20"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_21"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_22"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_23"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_24"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_25"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_26"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_27"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_28"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_29"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_30"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_31"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_32"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_33"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_34"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_35"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_36"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_37"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_38"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_39"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_40"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_41"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_42"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_43"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_44"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_45"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_46"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_47"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_48"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_49"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_50"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_51"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_52"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Step argument transformations</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">transform with matches</span></h3><ol><li class="step passed" id="features_transform_sample_feature_4"><div><span class="keyword">Then</span> <span class="step val">I should transform <span class="param">'10' to an Integer</span></span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">transform with matches that capture</span></h3><ol><li class="step passed" id="features_transform_sample_feature_7"><div><span class="keyword">Then</span> <span class="step val">I should transform <span class="param">'abc' to a Symbol</span></span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">transform without matches</span></h3><ol><li class="step passed" id="features_transform_sample_feature_10"><div><span class="keyword">Then</span> <span class="step val">I should not transform <span class="param">'10'</span> to an Integer</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: undefined multiline args</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">pystring</span></h3><ol><li class="step undefined" id="features_undefined_multiline_args_feature_4"><div><span class="keyword">Given</span> <span class="step val">a pystring</span></div><pre class="val"> example</pre></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">table</span></h3><ol><li class="step undefined" id="features_undefined_multiline_args_feature_10"><div><span class="keyword">Given</span> <span class="step val">a table</span></div><table><tr id="row_11"><td class="val" id="row_11_0">table</td></tr><tr id="row_12"><td class="val" id="row_12_0">example</td></tr></table></li></ol></div></div><div class="duration">0m30.005s</div></div></body></html>
@@ -48,7 +48,7 @@ Given /^I have environment variable (\w+) set to "([^\"]*)"$/ do |variable, valu
48
48
  end
49
49
 
50
50
  When /^I run cucumber (.*)$/ do |cucumber_opts|
51
- run "#{Cucumber::RUBY_BINARY} -I #{Spork::LIBDIR} #{Cucumber::BINARY} --no-color #{cucumber_opts}"
51
+ run "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} --no-color #{cucumber_opts}"
52
52
  end
53
53
 
54
54
  When /^I run rake (.*)$/ do |rake_opts|
@@ -94,15 +94,15 @@ Then /^"([^\"]*)" with junit duration "([^\"]*)" should contain$/ do |actual_fil
94
94
  actual.should == text
95
95
  end
96
96
 
97
- Then /^"([^\"]*)" should match$/ do |file, text|
97
+ Then /^"([^\"]*)" should match "([^\"]*)"$/ do |file, text|
98
98
  IO.read(file).should =~ Regexp.new(text)
99
99
  end
100
100
 
101
101
  Then /^"([^\"]*)" should have the same contents as "([^\"]*)"$/ do |actual_file, expected_file|
102
102
  actual = IO.read(actual_file)
103
103
  actual = replace_duration(actual, '0m30.005s')
104
- # Comment out to replace expected file. Use with care! Remember to update duration afterwards.
105
- # File.open(expected_file, "w") {|io| io.write(actual)}
104
+ # Comment out to replace expected file. Use with care!
105
+ File.open(expected_file, "w") {|io| io.write(actual)}
106
106
  actual.should == IO.read(expected_file)
107
107
  end
108
108
 
@@ -0,0 +1,24 @@
1
+ Feature: transform
2
+ In order to maintain modularity within step definitions
3
+ As a step definition editor
4
+ I want to register a regex to capture and tranform step definition arguments.
5
+
6
+ Scenario: run a specific scenario with a registered transform
7
+ When I run cucumber -q features/transform_sample.feature --require features
8
+ Then it should pass with
9
+ """
10
+ Feature: Step argument transformations
11
+
12
+ Scenario: transform with matches
13
+ Then I should transform '10' to an Integer
14
+
15
+ Scenario: transform with matches that capture
16
+ Then I should transform 'abc' to a Symbol
17
+
18
+ Scenario: transform without matches
19
+ Then I should not transform '10' to an Integer
20
+
21
+ 3 scenarios (3 passed)
22
+ 3 steps (3 passed)
23
+
24
+ """
@@ -116,8 +116,14 @@ Feature: Cucumber command line
116
116
  Given passing # features/sample.feature:12
117
117
  /^failing expectation$/ # features/step_definitions/sample_steps.rb:62
118
118
  Given failing expectation # features/failing_expectation.feature:4
119
+ /^I should transform ('\d+' to an Integer)$/ # features/step_definitions/sample_steps.rb:83
120
+ Then I should transform '10' to an Integer # features/transform_sample.feature:4
121
+ /^I should transform ('\w+' to a Symbol)$/ # features/step_definitions/sample_steps.rb:87
122
+ Then I should transform 'abc' to a Symbol # features/transform_sample.feature:7
119
123
  /^failing$/ # features/step_definitions/sample_steps.rb:8
120
124
  Given failing # features/sample.feature:18
125
+ /^I should not transform ('\d+') to an Integer$/ # features/step_definitions/sample_steps.rb:91
126
+ Then I should not transform '10' to an Integer # features/transform_sample.feature:10
121
127
  (::) UNUSED (::)
122
128
  /^unused$/ # features/step_definitions/sample_steps.rb:66
123
129
  /^another unused$/ # features/step_definitions/sample_steps.rb:69
@@ -27,7 +27,9 @@ module Cucumber
27
27
  end
28
28
 
29
29
  def count(tag)
30
- if @tag_names.respond_to?(:count)
30
+ # See discussion:
31
+ # http://github.com/weplay/cucumber/commit/2dc592acdf3f7c1a0c333a8164649936bb82d983
32
+ if @tag_names.respond_to?(:count) && @tag_names.method(:count).arity > 0
31
33
  @tag_names.count(tag) # 1.9
32
34
  else
33
35
  @tag_names.select{|t| t == tag}.length # 1.8
@@ -6,6 +6,9 @@ module Cucumber
6
6
  BUILTIN_FORMATS = {
7
7
  'html' => ['Cucumber::Formatter::Html', 'Generates a nice looking HTML report.'],
8
8
  'pretty' => ['Cucumber::Formatter::Pretty', 'Prints the feature as is - in colours.'],
9
+ 'pdf' => ['Cucumber::Formatter::Pdf', "Generates a PDF report. You need to have the\n" +
10
+ "#{' ' * 51}prawn gem installed. Will pick up logo from\n" +
11
+ "#{' ' * 51}features/support/logo.png if present."],
9
12
  'profile' => ['Cucumber::Formatter::Profile', 'Prints the 10 slowest steps at the end.'],
10
13
  'progress' => ['Cucumber::Formatter::Progress', 'Prints one character per scenario.'],
11
14
  'rerun' => ['Cucumber::Formatter::Rerun', 'Prints failing files with line numbers.'],
@@ -183,6 +186,7 @@ module Cucumber
183
186
  @options[:dry_run] = true
184
187
  @quiet = true
185
188
  end
189
+
186
190
  opts.on("-m", "--no-multiline",
187
191
  "Don't print multiline strings and tables under steps.") do
188
192
  @options[:no_multiline] = true
@@ -233,7 +237,7 @@ module Cucumber
233
237
  Kernel.exit
234
238
  end
235
239
  end.parse!
236
-
240
+
237
241
  if @quiet
238
242
  @options[:snippets] = @options[:source] = false
239
243
  else
@@ -21,7 +21,7 @@ class Object #:nodoc:
21
21
  )
22
22
  end
23
23
  else
24
- instance_exec(*args, &block)
24
+ instance_exec(*Cucumber::StepMother.transform_arguments(args), &block)
25
25
  end
26
26
  end
27
27
  end
@@ -253,7 +253,7 @@ module Cucumber
253
253
  end
254
254
 
255
255
  def format_exception(exception)
256
- (["#{exception.message} (#{exception.class})"] + exception.backtrace).join("\n")
256
+ h((["#{exception.message} (#{exception.class})"] + exception.backtrace).join("\n"))
257
257
  end
258
258
 
259
259
  end
@@ -0,0 +1,217 @@
1
+ require 'cucumber/formatter/console'
2
+ require 'fileutils'
3
+ require 'prawn'
4
+ require "prawn/layout"
5
+ require "prawn/format"
6
+
7
+ module Cucumber
8
+ module Formatter
9
+
10
+ BLACK = '000000'
11
+ GREY = '999999'
12
+
13
+ class Pdf < Ast::Visitor
14
+ include FileUtils
15
+ include Console
16
+ attr_writer :indent
17
+
18
+ def initialize(step_mother, io, options)
19
+ super(step_mother)
20
+ raise "You *must* specify --out FILE for the pdf formatter" unless File === io
21
+
22
+ if(options[:dry_run])
23
+ @status_colors = { :passed => BLACK, :skipped => BLACK, :undefined => BLACK, :failed => BLACK}
24
+ else
25
+ @status_colors = { :passed => '055902', :skipped => GREY, :undefined => 'F27405', :failed => '730202'}
26
+ end
27
+
28
+ @pdf = Prawn::Document.new
29
+ @scrap = Prawn::Document.new
30
+ @doc = @scrap
31
+ @io = io
32
+ @options = options
33
+ @exceptions = []
34
+ @indent = 0
35
+ @buffer = []
36
+ puts "writing to #{io.path}"
37
+ begin
38
+ @pdf.image open("features/support/logo.png"), :position => :center, :width => 500
39
+ rescue
40
+ end
41
+ @pdf.text "\n\n\nCucumber features", :align => :center, :size => 32
42
+ @pdf.text "Generated: #{Time.now.strftime("%Y-%m-%d %H:%M")}", :size => 10, :at => [0, 24]
43
+ @pdf.text "Command: <code>cucumber #{ARGV.join(" ")}</code>", :size => 10, :at => [0,10]
44
+ unless options[:dry_run]
45
+ @pdf.bounding_box [450,100] , :width => 100 do
46
+ @pdf.text 'Legend', :size => 10
47
+ @status_colors.each do |k,v|
48
+ @pdf.fill_color v
49
+ @pdf.text k.to_s, :size => 10
50
+ @pdf.fill_color BLACK
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ def keep_with(&block)
57
+ @buffer << block
58
+ end
59
+
60
+ def render(doc)
61
+ @doc = doc
62
+ @buffer.each do |proc|
63
+ proc.call
64
+ end
65
+ end
66
+
67
+ # This method does a 'test' rendering on a blank page, to see the rendered height of the buffer
68
+ # if that too high for the space left on the age in the real document, we do a page break.
69
+ # This obviously doesn't work if a scenario is longer than a whole page (God forbid)
70
+ def flush
71
+ @scrap.start_new_page
72
+ oldy = @scrap.y
73
+ render @scrap
74
+ height = (oldy - @scrap.y) + 36 # whops magic number
75
+ if ((@pdf.y - height) < @pdf.bounds.bottom)
76
+ @pdf.start_new_page
77
+ end
78
+ render @pdf
79
+ @pdf.move_down(20)
80
+ @buffer = []
81
+ end
82
+
83
+ # regular visitor entries
84
+ def visit_features(features)
85
+ super
86
+ @pdf.render_file(@io.path)
87
+ puts "\ndone"
88
+ end
89
+
90
+ def visit_feature_name(name)
91
+ @pdf.start_new_page
92
+ name["Feature:"] = "" if name["Feature:"]
93
+ names = name.split("\n")
94
+ @pdf.fill_color GREY
95
+ @pdf.text('Feature', :align => :center)
96
+ @pdf.fill_color BLACK
97
+ names.each_with_index do |nameline, i|
98
+ case i
99
+ when 0
100
+ @pdf.text(nameline.strip, :size => 30, :align => :center )
101
+ @pdf.text("\n")
102
+ else
103
+ @pdf.text(nameline.strip, :size => 12)
104
+ end
105
+ end
106
+ @pdf.move_down(30)
107
+ end
108
+
109
+ def visit_feature_element(feature_element)
110
+ record_tag_occurrences(feature_element, @options)
111
+ super
112
+ flush
113
+ end
114
+
115
+ def visit_feature(feature)
116
+ super
117
+ flush
118
+ end
119
+
120
+ def visit_feature_element_name(keyword, name)
121
+ names = name.empty? ? [name] : name.split("\n")
122
+ print "."
123
+ STDOUT.flush
124
+
125
+ keep_with do
126
+ @doc.move_down(20)
127
+ @doc.fill_color GREY
128
+ @doc.text("#{keyword}", :size => 8)
129
+ @doc.fill_color BLACK
130
+ @doc.text("#{names[0]}", :size => 16)
131
+ names[1..-1].each { |s| @doc.text(s, :size => 12) }
132
+ @doc.text("\n")
133
+ end
134
+ end
135
+
136
+ def visit_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
137
+ if exception
138
+ return if @exceptions.index(exception)
139
+ @exceptions << exception
140
+ end
141
+ return if status != :failed && @in_background ^ background
142
+ @status = status
143
+ super
144
+ end
145
+
146
+ def colorize(text, status)
147
+ keep_with do
148
+ @doc.fill_color(@status_colors[status] || BLACK)
149
+ @doc.text(text)
150
+ @doc.fill_color(BLACK)
151
+ end
152
+ end
153
+
154
+ def visit_step_name(keyword, step_match, status, source_indent, background)
155
+ line = "<b>#{keyword}</b> #{step_match.format_args("%s").gsub('<', '&lt;').gsub('>', '&gt;')}"
156
+ colorize(line, status)
157
+ end
158
+
159
+ def visit_background(background)
160
+ @in_background = true
161
+ super
162
+ @in_background = nil
163
+ end
164
+
165
+ def visit_multiline_arg(table)
166
+ if(table.kind_of? Cucumber::Ast::Table)
167
+ keep_with do
168
+ @doc.table(table.rows << table.headers , :position => :center, :row_colors => ['ffffff', 'f0f0f0'])
169
+ end
170
+ end
171
+ super
172
+ end
173
+
174
+ #using row_color hack to highlight each row correctly
175
+ def visit_outline_table(table)
176
+ row_colors = table.example_rows.map { |r| @status_colors[r.status] unless r.status == :skipped}
177
+ keep_with do
178
+ @doc.table(table.rows, :headers => table.headers, :position => :center, :row_colors => row_colors)
179
+ end
180
+ end
181
+
182
+ def visit_py_string(string)
183
+ s = %{"""\n#{string}\n"""}.indent(10)
184
+ s = s.split("\n").map{|l| l =~ /^\s+$/ ? '' : l}
185
+ s.each do |line|
186
+ line.gsub!('<', '&lt;')
187
+ line.gsub!('>', '&gt;')
188
+ keep_with { @doc.text line, :size => 8 }
189
+ end
190
+ end
191
+
192
+ def visit_comment(comment)
193
+ comment.accept(self)
194
+ end
195
+
196
+ def visit_comment_line(comment_line)
197
+ end
198
+
199
+ def visit_tag_name(tag_name)
200
+ tag = format_string("@#{tag_name}", :tag).indent(@indent)
201
+ # TODO should we render tags at all? skipped for now. difficult to place due to page breaks
202
+ end
203
+
204
+ def visit_background_name(keyword, name, file_colon_line, source_indent)
205
+ visit_feature_element_name(keyword, name)
206
+ end
207
+
208
+ def visit_examples_name(keyword, name)
209
+ visit_feature_element_name(keyword, name)
210
+ end
211
+
212
+ def visit_scenario_name(keyword, name, file_colon_line, source_indent)
213
+ visit_feature_element_name(keyword, name)
214
+ end
215
+ end
216
+ end
217
+ end
@@ -65,6 +65,15 @@ module Cucumber
65
65
  def AfterStep(*tag_names, &proc)
66
66
  RbDsl.register_rb_hook('after_step', tag_names, proc)
67
67
  end
68
+
69
+ # Registers a proc that will be called with a step definition argument if it
70
+ # matches the pattern passed as the first argument to Transform. Alternatively, if
71
+ # the pattern contains captures then they will be yielded as arguments to the
72
+ # provided proc. The return value of the proc is consequently yielded to the
73
+ # step definition.
74
+ def Transform(*args, &proc)
75
+ StepMother.register_transform(*args, &proc)
76
+ end
68
77
 
69
78
  # Registers a proc that will run after Cucumber is configured. You can register as
70
79
  # as you want (typically from ruby scripts under <tt>support/hooks.rb</tt>).
@@ -88,4 +97,4 @@ module Cucumber
88
97
  end
89
98
  end
90
99
 
91
- extend(Cucumber::RbSupport::RbDsl)
100
+ extend(Cucumber::RbSupport::RbDsl)
@@ -50,8 +50,9 @@ module Cucumber
50
50
 
51
51
  # This is the meaty part of Cucumber that ties everything together.
52
52
  class StepMother
53
- include Constantize
54
-
53
+ include Constantize
54
+ @@transforms = []
55
+ StepArgumentTransform = Struct.new(:pattern, :transformer)
55
56
  attr_writer :options, :visitor, :log
56
57
 
57
58
  def initialize
@@ -60,6 +61,32 @@ module Cucumber
60
61
  @language_map = {}
61
62
  load_natural_language('en')
62
63
  end
64
+
65
+ def self.register_transform(pattern, &transformer)
66
+ raise Cucumber::ArityMismatchError.new('Transform must be registered with at least a one-argument block') if !block_given? || transformer.arity < 1
67
+ @@transforms.unshift StepArgumentTransform.new(Regexp.new(pattern), transformer.to_proc)
68
+ end
69
+
70
+ def self.transform_arguments(step_args)
71
+ matched = nil
72
+ step_args.map do |step_arg|
73
+ if transform = @@transforms.detect {|t| matched = t.pattern.match(step_arg) if step_arg.is_a?(String) }
74
+ if matched.captures.empty?
75
+ unless transform.transformer.arity == 1
76
+ raise Cucumber::ArityMismatchError.new("Transforms without Regexp captures only accept a single argument (the step argument)")
77
+ end
78
+ transform.transformer.call(step_arg)
79
+ else
80
+ if transform.transformer.arity != matched.captures.size
81
+ raise Cucumber::ArityMismatchError.new("Number of arguments in Transform (#{transform.transformer.arity}) does not match number of Regexp captures (#{matched.captures.size})")
82
+ end
83
+ transform.transformer.call(*matched.captures)
84
+ end
85
+ else
86
+ step_arg
87
+ end
88
+ end
89
+ end
63
90
 
64
91
  def load_plain_text_features(feature_files)
65
92
  features = Ast::Features.new
@@ -2,7 +2,7 @@ module Cucumber #:nodoc:
2
2
  class VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 100
5
+ TINY = 101
6
6
  PATCH = nil # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
@@ -24,7 +24,7 @@ When /^I follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
24
24
  end
25
25
 
26
26
  When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
27
- fill_in(field, :with => value)
27
+ fill_in(field, :with => value)
28
28
  end
29
29
 
30
30
  When /^I fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field|
@@ -49,16 +49,16 @@ When /^I fill in the following:$/ do |fields|
49
49
  end
50
50
 
51
51
  When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
52
- select(value, :from => field)
52
+ select(value, :from => field)
53
53
  end
54
54
 
55
55
  # Use this step in conjunction with Rail's datetime_select helper. For example:
56
- # When I select "December 25, 2008 10:00" as the date and time
56
+ # When I select "December 25, 2008 10:00" as the date and time
57
57
  When /^I select "([^\"]*)" as the date and time$/ do |time|
58
58
  select_datetime(time)
59
59
  end
60
60
 
61
- # Use this step when using multiple datetime_select helpers on a page or
61
+ # Use this step when using multiple datetime_select helpers on a page or
62
62
  # you want to specify which datetime to select. Given the following view:
63
63
  # <%%= f.label :preferred %><br />
64
64
  # <%%= f.datetime_select :preferred %>
@@ -74,7 +74,7 @@ end
74
74
  # Use this step in conjunction with Rail's time_select helper. For example:
75
75
  # When I select "2:20PM" as the time
76
76
  # Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
77
- # will convert the 2:20PM to 14:20 and then select it.
77
+ # will convert the 2:20PM to 14:20 and then select it.
78
78
  When /^I select "([^\"]*)" as the time$/ do |time|
79
79
  select_time(time)
80
80
  end
@@ -100,11 +100,11 @@ When /^I select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
100
100
  end
101
101
 
102
102
  When /^I check "([^\"]*)"$/ do |field|
103
- check(field)
103
+ check(field)
104
104
  end
105
105
 
106
106
  When /^I uncheck "([^\"]*)"$/ do |field|
107
- uncheck(field)
107
+ uncheck(field)
108
108
  end
109
109
 
110
110
  When /^I choose "([^\"]*)"$/ do |field|
@@ -123,6 +123,16 @@ Then /^I should see "([^\"]*)"$/ do |text|
123
123
  <% end -%>
124
124
  end
125
125
 
126
+ Then /^I should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
127
+ within(selector) do |content|
128
+ <% if framework == :rspec -%>
129
+ content.should contain(text)
130
+ <% else -%>
131
+ assert content.include?(text)
132
+ <% end -%>
133
+ end
134
+ end
135
+
126
136
  Then /^I should see \/([^\/]*)\/$/ do |regexp|
127
137
  regexp = Regexp.new(regexp)
128
138
  <% if framework == :rspec -%>
@@ -132,6 +142,17 @@ Then /^I should see \/([^\/]*)\/$/ do |regexp|
132
142
  <% end -%>
133
143
  end
134
144
 
145
+ Then /^I should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
146
+ within(selector) do |content|
147
+ regexp = Regexp.new(regexp)
148
+ <% if framework == :rspec -%>
149
+ content.should contain(regexp)
150
+ <% else -%>
151
+ assert content =~ regexp
152
+ <% end -%>
153
+ end
154
+ end
155
+
135
156
  Then /^I should not see "([^\"]*)"$/ do |text|
136
157
  <% if framework == :rspec -%>
137
158
  response.should_not contain(text)
@@ -140,6 +161,16 @@ Then /^I should not see "([^\"]*)"$/ do |text|
140
161
  <% end -%>
141
162
  end
142
163
 
164
+ Then /^I should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
165
+ within(selector) do |content|
166
+ <% if framework == :rspec -%>
167
+ content.should_not contain(text)
168
+ <% else -%>
169
+ assert !content.include?(text)
170
+ <% end -%>
171
+ end
172
+ end
173
+
143
174
  Then /^I should not see \/([^\/]*)\/$/ do |regexp|
144
175
  regexp = Regexp.new(regexp)
145
176
  <% if framework == :rspec -%>
@@ -149,6 +180,17 @@ Then /^I should not see \/([^\/]*)\/$/ do |regexp|
149
180
  <% end -%>
150
181
  end
151
182
 
183
+ Then /^I should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
184
+ within(selector) do |content|
185
+ regexp = Regexp.new(regexp)
186
+ <% if framework == :rspec -%>
187
+ content.should_not contain(regexp)
188
+ <% else -%>
189
+ assert content !~ regexp
190
+ <% end -%>
191
+ end
192
+ end
193
+
152
194
  Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
153
195
  <% if framework == :rspec -%>
154
196
  field_labeled(field).value.should =~ /#{value}/
@@ -164,7 +206,7 @@ Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
164
206
  assert_no_match(/#{value}/, field_labeled(field).value)
165
207
  <% end -%>
166
208
  end
167
-
209
+
168
210
  Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
169
211
  <% if framework == :rspec -%>
170
212
  field_labeled(label).should be_checked
@@ -184,4 +184,99 @@ or http://wiki.github.com/aslakhellesoy/cucumber/a-whole-new-world.
184
184
  @rb.hooks_for(:before, scenario).should == [fish]
185
185
  end
186
186
  end
187
+
188
+ describe StepMother, "step argument transformations" do
189
+ after(:each) do
190
+ # generally transforms are global, but state should be
191
+ # cleared when testing them here at the unit level
192
+ class StepMother; @@transforms = [] end
193
+ end
194
+
195
+ describe "without capture groups" do
196
+ it "complains when registering with a with no transform block" do
197
+ lambda do
198
+ StepMother.register_transform('^abc$')
199
+ end.should raise_error(Cucumber::ArityMismatchError)
200
+ end
201
+
202
+ it "complains when registering with a zero-arg transform block" do
203
+ lambda do
204
+ StepMother.register_transform('^abc$') {42}
205
+ end.should raise_error(Cucumber::ArityMismatchError)
206
+ end
207
+
208
+ it "complains when registering with a splat-arg transform block" do
209
+ lambda do
210
+ StepMother.register_transform('^abc$') {|*splat| 42 }
211
+ end.should raise_error(Cucumber::ArityMismatchError)
212
+ end
213
+
214
+ it "complains when transforming with an arity mismatch" do
215
+ lambda do
216
+ StepMother.register_transform('^abc$') {|one, two| 42 }
217
+ StepMother.transform_arguments(['abc'])
218
+ end.should raise_error(Cucumber::ArityMismatchError)
219
+ end
220
+
221
+ it "allows registering a regexp pattern that yields the step_arg matched" do
222
+ StepMother.register_transform(/^ab*c$/) {|arg| 42}
223
+ StepMother.transform_arguments(['ab']).should == ['ab']
224
+ StepMother.transform_arguments(['ac']).should == [42]
225
+ StepMother.transform_arguments(['abc']).should == [42]
226
+ StepMother.transform_arguments(['abbc']).should == [42]
227
+ end
228
+ end
229
+
230
+ describe "with capture groups" do
231
+ it "complains when registering with a with no transform block" do
232
+ lambda do
233
+ StepMother.register_transform('^a(.)c$')
234
+ end.should raise_error(Cucumber::ArityMismatchError)
235
+ end
236
+
237
+ it "complains when registering with a zero-arg transform block" do
238
+ lambda do
239
+ StepMother.register_transform('^a(.)c$') { 42 }
240
+ end.should raise_error(Cucumber::ArityMismatchError)
241
+ end
242
+
243
+ it "complains when registering with a splat-arg transform block" do
244
+ lambda do
245
+ StepMother.register_transform('^a(.)c$') {|*splat| 42 }
246
+ end.should raise_error(Cucumber::ArityMismatchError)
247
+ end
248
+
249
+ it "complains when transforming with an arity mismatch" do
250
+ lambda do
251
+ StepMother.register_transform('^a(.)c$') {|one, two| 42 }
252
+ StepMother.transform_arguments(['abc'])
253
+ end.should raise_error(Cucumber::ArityMismatchError)
254
+ end
255
+
256
+ it "allows registering a regexp pattern that yields capture groups" do
257
+ StepMother.register_transform(/^shape: (.+), color: (.+)$/) do |shape, color|
258
+ {shape.to_sym => color.to_sym}
259
+ end
260
+ StepMother.transform_arguments(['shape: circle, color: blue']).should == [{:circle => :blue}]
261
+ StepMother.transform_arguments(['shape: square, color: red']).should == [{:square => :red}]
262
+ StepMother.transform_arguments(['not shape: square, not color: red']).should == ['not shape: square, not color: red']
263
+ end
264
+ end
265
+
266
+ it "allows registering a string pattern" do
267
+ StepMother.register_transform('^ab*c$') {|arg| 42}
268
+ StepMother.transform_arguments(['ab']).should == ['ab']
269
+ StepMother.transform_arguments(['ac']).should == [42]
270
+ StepMother.transform_arguments(['abc']).should == [42]
271
+ StepMother.transform_arguments(['abbc']).should == [42]
272
+ end
273
+
274
+ it "gives match priority to transforms defined last" do
275
+ StepMother.register_transform(/^transform_me$/) {|arg| :foo }
276
+ StepMother.register_transform(/^transform_me$/) {|arg| :bar }
277
+ StepMother.register_transform(/^transform_me$/) {|arg| :baz }
278
+ StepMother.transform_arguments(['transform_me']).should == [:baz]
279
+ end
280
+ end
281
+
187
282
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.100
4
+ version: 0.3.101
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-09 00:00:00 +02:00
12
+ date: 2009-09-15 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -289,6 +289,7 @@ files:
289
289
  - examples/self_test/features/support/env.rb
290
290
  - examples/self_test/features/tags_sample.feature
291
291
  - examples/self_test/features/tons_of_cukes.feature
292
+ - examples/self_test/features/transform_sample.feature
292
293
  - examples/self_test/features/undefined_multiline_args.feature
293
294
  - examples/self_test/list-of-features.txt
294
295
  - examples/sinatra/README.textile
@@ -367,6 +368,7 @@ files:
367
368
  - features/steps_formatter.feature
368
369
  - features/support/env.rb
369
370
  - features/table_diffing.feature
371
+ - features/transform.feature
370
372
  - features/unicode_table.feature
371
373
  - features/usage.feature
372
374
  - features/work_in_progress.feature
@@ -427,6 +429,7 @@ files:
427
429
  - lib/cucumber/formatter/html.rb
428
430
  - lib/cucumber/formatter/junit.rb
429
431
  - lib/cucumber/formatter/ordered_xml_markup.rb
432
+ - lib/cucumber/formatter/pdf.rb
430
433
  - lib/cucumber/formatter/pretty.rb
431
434
  - lib/cucumber/formatter/profile.rb
432
435
  - lib/cucumber/formatter/progress.rb