aslakhellesoy-cucumber 0.3.101 → 0.3.101.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +26 -2
- data/Manifest.txt +6 -4
- data/config/hoe.rb +2 -2
- data/examples/pure_java/README.textile +2 -2
- data/examples/self_test/features/step_definitions/sample_steps.rb +0 -12
- data/examples/self_test/features/support/env.rb +0 -6
- data/features/cucumber_cli.feature +11 -24
- data/features/custom_formatter.feature +2 -2
- data/features/default_snippets.feature +42 -0
- data/features/html_formatter/a.html +1 -1
- data/features/negative_tagged_hooks.feature +61 -0
- data/features/step_definitions/cucumber_steps.rb +1 -1
- data/features/transform.feature +88 -12
- data/features/usage.feature +0 -6
- data/lib/cucumber/ast/feature.rb +4 -0
- data/lib/cucumber/ast/feature_element.rb +49 -42
- data/lib/cucumber/ast/step_invocation.rb +1 -1
- data/lib/cucumber/ast/tags.rb +25 -3
- data/lib/cucumber/cli/drb_client.rb +7 -1
- data/lib/cucumber/cli/main.rb +4 -3
- data/lib/cucumber/cli/options.rb +13 -24
- data/lib/cucumber/core_ext/instance_exec.rb +2 -1
- data/lib/cucumber/filter.rb +2 -12
- data/lib/cucumber/formatter/console.rb +21 -21
- data/lib/cucumber/formatter/html.rb +1 -1
- data/lib/cucumber/formatter/pdf.rb +1 -1
- data/lib/cucumber/formatter/pretty.rb +1 -1
- data/lib/cucumber/language_support/language_methods.rb +19 -2
- data/lib/cucumber/parser/feature.rb +13 -50
- data/lib/cucumber/parser/feature.tt +13 -47
- data/lib/cucumber/parser/natural_language.rb +1 -1
- data/lib/cucumber/rails/action_controller.rb +33 -0
- data/lib/cucumber/rails/active_record.rb +27 -0
- data/lib/cucumber/rails/rspec.rb +1 -1
- data/lib/cucumber/rails/test_unit.rb +9 -0
- data/lib/cucumber/rails/world.rb +7 -78
- data/lib/cucumber/rb_support/rb_dsl.rb +6 -4
- data/lib/cucumber/rb_support/rb_language.rb +8 -2
- data/lib/cucumber/rb_support/rb_step_definition.rb +2 -5
- data/lib/cucumber/rb_support/rb_transform.rb +35 -0
- data/lib/cucumber/rb_support/rb_world.rb +7 -1
- data/lib/cucumber/step_match.rb +1 -1
- data/lib/cucumber/step_mother.rb +8 -31
- data/lib/cucumber/version.rb +1 -1
- data/rails_generators/cucumber/templates/cucumber_environment.rb +2 -2
- data/rails_generators/cucumber/templates/env.rb +1 -8
- data/spec/cucumber/ast/feature_element_spec.rb +24 -23
- data/spec/cucumber/ast/scenario_outline_spec.rb +1 -1
- data/spec/cucumber/cli/options_spec.rb +5 -14
- data/spec/cucumber/parser/feature_parser_spec.rb +6 -6
- data/spec/cucumber/step_mother_spec.rb +41 -38
- metadata +10 -8
- data/examples/self_test/features/transform_sample.feature +0 -10
- data/spec/cucumber/rails/stubs/mini_rails.rb +0 -18
- data/spec/cucumber/rails/stubs/test_help.rb +0 -1
- data/spec/cucumber/rails/world_spec.rb +0 -16
data/History.txt
CHANGED
@@ -1,6 +1,30 @@
|
|
1
|
-
== In Git
|
1
|
+
== (In Git)
|
2
2
|
|
3
|
-
|
3
|
+
This release has some changes in the Rails support, so make sure you run "script/generate cucumber" after you upgrade.
|
4
|
+
|
5
|
+
=== New Features
|
6
|
+
* New @allow_rescue tag for Rails scenarios. Causes exceptions raised in actions to be caught by rails and not bubble up to Cucumber (Aslak Hellesøy)
|
7
|
+
* Negative tags can now be used in hooks, just like the command line's --tags option: Before('~@yarr') - will run for all scenarios that *don't* have the @yarr tag. (Aslak Hellesøy)
|
8
|
+
* Transform has current "World" scope (Larry Diehl)
|
9
|
+
* Other Transforms can be reused by calling Transform with a string inside of another Transform definition (Larry Diehl)
|
10
|
+
* Execute "After" hooks in reverse order of declaration for better behavior with dependent blocks and to mimic the behavior of at_exit (David Waite)
|
11
|
+
|
12
|
+
=== Bugfixes
|
13
|
+
* Missing step_definition snippets not properly displayed (#433 Aslak Hellesøy)
|
14
|
+
* rspec-rails, :lib => false (#447 David Chelimsky)
|
15
|
+
* Cucumber with Spork breaks on OS X Snow Leopard (#431 David Chelimsky)
|
16
|
+
|
17
|
+
=== Changed Features
|
18
|
+
* Tag names passed on the command line *always* have to use the @ sign. --tags foo or --tags ~bar won't work. Use --tags @foo or --tags ~@bar (Aslak Hellesøy)
|
19
|
+
|
20
|
+
=== Removed features
|
21
|
+
* The Cucumber::Rails.bypass_rescue no longer exists. Errors will always bubble up, unless you use the new @allow_rescue tag. (Aslak Hellesøy)
|
22
|
+
* The Cucumber::Rails.use_transactional_fixtures no longer exists. Transactional fixtures are always enabled for the cucumber environment. (Aslak Hellesøy)
|
23
|
+
|
24
|
+
== 0.3.101 2009-09-15
|
25
|
+
|
26
|
+
Two exciting things in this release. Step Argument Transforms and a PDF formatter you can use to send
|
27
|
+
your features to your customer for review!
|
4
28
|
|
5
29
|
=== New Features
|
6
30
|
* New pdf formatter (#425 Mads Buus)
|
data/Manifest.txt
CHANGED
@@ -211,7 +211,6 @@ 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
|
215
214
|
examples/self_test/features/undefined_multiline_args.feature
|
216
215
|
examples/self_test/list-of-features.txt
|
217
216
|
examples/sinatra/README.textile
|
@@ -269,6 +268,7 @@ features/cucumber_cli.feature
|
|
269
268
|
features/cucumber_cli_diff_disabled.feature
|
270
269
|
features/cucumber_cli_outlines.feature
|
271
270
|
features/custom_formatter.feature
|
271
|
+
features/default_snippets.feature
|
272
272
|
features/drb_server_integration.feature
|
273
273
|
features/exception_in_after_block.feature
|
274
274
|
features/exception_in_after_step_block.feature
|
@@ -280,6 +280,7 @@ features/html_formatter/a.html
|
|
280
280
|
features/junit_formatter.feature
|
281
281
|
features/language_from_header.feature
|
282
282
|
features/multiline_names.feature
|
283
|
+
features/negative_tagged_hooks.feature
|
283
284
|
features/post_configuration_hook.feature
|
284
285
|
features/profiles.feature
|
285
286
|
features/rake_task.feature
|
@@ -377,13 +378,17 @@ lib/cucumber/platform.rb
|
|
377
378
|
lib/cucumber/py_support/py_dsl.py
|
378
379
|
lib/cucumber/py_support/py_language.py
|
379
380
|
lib/cucumber/py_support/py_language.rb
|
381
|
+
lib/cucumber/rails/action_controller.rb
|
382
|
+
lib/cucumber/rails/active_record.rb
|
380
383
|
lib/cucumber/rails/rspec.rb
|
384
|
+
lib/cucumber/rails/test_unit.rb
|
381
385
|
lib/cucumber/rails/world.rb
|
382
386
|
lib/cucumber/rake/task.rb
|
383
387
|
lib/cucumber/rb_support/rb_dsl.rb
|
384
388
|
lib/cucumber/rb_support/rb_hook.rb
|
385
389
|
lib/cucumber/rb_support/rb_language.rb
|
386
390
|
lib/cucumber/rb_support/rb_step_definition.rb
|
391
|
+
lib/cucumber/rb_support/rb_transform.rb
|
387
392
|
lib/cucumber/rb_support/rb_world.rb
|
388
393
|
lib/cucumber/rspec_neuter.rb
|
389
394
|
lib/cucumber/step_match.rb
|
@@ -429,9 +434,6 @@ spec/cucumber/formatter/html_spec.rb
|
|
429
434
|
spec/cucumber/formatter/progress_spec.rb
|
430
435
|
spec/cucumber/parser/feature_parser_spec.rb
|
431
436
|
spec/cucumber/parser/table_parser_spec.rb
|
432
|
-
spec/cucumber/rails/stubs/mini_rails.rb
|
433
|
-
spec/cucumber/rails/stubs/test_help.rb
|
434
|
-
spec/cucumber/rails/world_spec.rb
|
435
437
|
spec/cucumber/rb_support/rb_step_definition_spec.rb
|
436
438
|
spec/cucumber/sell_cucumbers.feature
|
437
439
|
spec/cucumber/step_mother_spec.rb
|
data/config/hoe.rb
CHANGED
@@ -62,8 +62,8 @@ $hoe = Hoe.spec(GEM_NAME) do |p|
|
|
62
62
|
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
63
63
|
p.extra_deps = [
|
64
64
|
['term-ansicolor', '>= 1.0.3'],
|
65
|
-
['treetop', '>= 1.
|
66
|
-
['polyglot', '>= 0.2.
|
65
|
+
['treetop', '>= 1.4.2'],
|
66
|
+
['polyglot', '>= 0.2.9'], # Don't really want polyglot, but it keeps breaking so we'll make people use something that works ok'ish
|
67
67
|
['diff-lcs', '>= 1.1.2'],
|
68
68
|
['builder', '>= 2.1.2']
|
69
69
|
]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
h1. Cucumber with pure Java
|
2
2
|
|
3
|
-
|
3
|
+
Nothing here in the Cucumber codebase, but check out "Cuke4Duke":http://wiki.github.com/aslakhellesoy/cuke4duke
|
4
4
|
|
5
|
-
|
5
|
+
Cuke4Duke lets you write step definitions in Java, Groovy and an increasing number of languages that run on the JVM.
|
@@ -79,15 +79,3 @@ 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,9 +16,3 @@ 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 }
|
@@ -351,17 +351,6 @@ 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
|
-
|
365
354
|
Feature: undefined multiline args
|
366
355
|
|
367
356
|
Scenario: pystring
|
@@ -375,8 +364,8 @@ Feature: Cucumber command line
|
|
375
364
|
| table |
|
376
365
|
| example |
|
377
366
|
|
378
|
-
|
379
|
-
|
367
|
+
26 scenarios (17 skipped, 8 undefined, 1 passed)
|
368
|
+
42 steps (30 skipped, 12 undefined)
|
380
369
|
|
381
370
|
"""
|
382
371
|
|
@@ -453,7 +442,7 @@ Feature: Cucumber command line
|
|
453
442
|
|
454
443
|
|
455
444
|
Scenario: Run with a tag that exists on 2 scenarios
|
456
|
-
When I run cucumber -q features --tags three
|
445
|
+
When I run cucumber -q features --tags @three
|
457
446
|
Then it should pass with
|
458
447
|
"""
|
459
448
|
# Feature comment
|
@@ -478,7 +467,7 @@ Feature: Cucumber command line
|
|
478
467
|
|
479
468
|
@mri186
|
480
469
|
Scenario: Run with a tag that exists on 1 feature
|
481
|
-
When I run cucumber -q features --tags one
|
470
|
+
When I run cucumber -q features --tags @one
|
482
471
|
Then it should fail with
|
483
472
|
"""
|
484
473
|
# Feature comment
|
@@ -516,7 +505,7 @@ Feature: Cucumber command line
|
|
516
505
|
"""
|
517
506
|
|
518
507
|
Scenario: Run with a negative tag
|
519
|
-
When I run cucumber -q features/sample.feature --dry-run
|
508
|
+
When I run cucumber -q features/sample.feature --dry-run --tags ~@four
|
520
509
|
Then it should pass with
|
521
510
|
"""
|
522
511
|
# Feature comment
|
@@ -539,8 +528,8 @@ Feature: Cucumber command line
|
|
539
528
|
|
540
529
|
"""
|
541
530
|
|
542
|
-
Scenario: Run with limited tag
|
543
|
-
When I run cucumber -q features/tags_sample.feature --dry-run
|
531
|
+
Scenario: Run with limited tag count, blowing it on scenario
|
532
|
+
When I run cucumber -q features/tags_sample.feature --dry-run --tags @sample_three:1
|
544
533
|
Then it should fail with
|
545
534
|
"""
|
546
535
|
@sample_one
|
@@ -561,15 +550,14 @@ Feature: Cucumber command line
|
|
561
550
|
2 scenarios (2 undefined)
|
562
551
|
2 steps (2 undefined)
|
563
552
|
|
564
|
-
|
565
|
-
@sample_three occurred:2 limit:1
|
553
|
+
@sample_three occurred 2 times, but the limit was set to 1
|
566
554
|
features/tags_sample.feature:9
|
567
555
|
features/tags_sample.feature:16
|
568
556
|
|
569
557
|
"""
|
570
558
|
|
571
|
-
Scenario: Run with
|
572
|
-
When I run cucumber -q features/tags_sample.feature --dry-run
|
559
|
+
Scenario: Run with limited tag count, blowing it via feature inheritance
|
560
|
+
When I run cucumber -q features/tags_sample.feature --dry-run --tags @sample_one:1
|
573
561
|
Then it should fail with
|
574
562
|
"""
|
575
563
|
@sample_one
|
@@ -594,8 +582,7 @@ Feature: Cucumber command line
|
|
594
582
|
3 scenarios (3 undefined)
|
595
583
|
3 steps (3 undefined)
|
596
584
|
|
597
|
-
|
598
|
-
@sample_one occurred:3 limit:1
|
585
|
+
@sample_one occurred 3 times, but the limit was set to 1
|
599
586
|
features/tags_sample.feature:5
|
600
587
|
features/tags_sample.feature:9
|
601
588
|
features/tags_sample.feature:16
|
@@ -4,8 +4,8 @@ Feature: Custom Formatter
|
|
4
4
|
When I run cucumber --format Cucumber::Formatter::TagCloud features
|
5
5
|
Then it should fail with
|
6
6
|
"""
|
7
|
-
| after_file | background_tagged_before_on_outline | four | lots | one | sample_four | sample_one | sample_three | sample_two | three | two |
|
8
|
-
| 1
|
7
|
+
| @after_file | @background_tagged_before_on_outline | @four | @lots | @one | @sample_four | @sample_one | @sample_three | @sample_two | @three | @two |
|
8
|
+
| 1 | 1 | 1 | 1 | 1 | 2 | 1 | 2 | 1 | 2 | 1 |
|
9
9
|
|
10
10
|
"""
|
11
11
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Feature: Print snippets
|
2
|
+
In order to make it easier to implement step definitions
|
3
|
+
Developers should get a scaffolding for undefined step definitions
|
4
|
+
|
5
|
+
Scenario: Cucumber doesn't know what language, and defaults to Ruby
|
6
|
+
Given a standard Cucumber project directory structure
|
7
|
+
And a file named "features/x.feature" with:
|
8
|
+
"""
|
9
|
+
Feature: X
|
10
|
+
Scenario: Y
|
11
|
+
Given Z
|
12
|
+
Given Q
|
13
|
+
"""
|
14
|
+
When I run cucumber features
|
15
|
+
Then STDERR should be empty
|
16
|
+
And it should pass with
|
17
|
+
"""
|
18
|
+
Feature: X
|
19
|
+
|
20
|
+
Scenario: Y # features/x.feature:2
|
21
|
+
Given Z # features/x.feature:3
|
22
|
+
Given Q # features/x.feature:4
|
23
|
+
|
24
|
+
1 scenario (1 undefined)
|
25
|
+
2 steps (2 undefined)
|
26
|
+
|
27
|
+
You can implement step definitions for undefined steps with these snippets:
|
28
|
+
|
29
|
+
Given /^Z$/ do
|
30
|
+
pending
|
31
|
+
end
|
32
|
+
|
33
|
+
Given /^Q$/ do
|
34
|
+
pending
|
35
|
+
end
|
36
|
+
|
37
|
+
If you want snippets in a different programming language, just make sure a file
|
38
|
+
with the appropriate file extension exists where cucumber looks for step definitions.
|
39
|
+
|
40
|
+
|
41
|
+
"""
|
42
|
+
|
@@ -180,4 +180,4 @@ features/search_sample.feature:13:in `Given <state> without a table'</pre>
|
|
180
180
|
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
181
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"><state></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: 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>
|
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>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
Feature: Tagged hooks
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a standard Cucumber project directory structure
|
5
|
+
And a file named "features/step_definitions/steps.rb" with:
|
6
|
+
"""
|
7
|
+
Given /^this step works$/ do
|
8
|
+
end
|
9
|
+
"""
|
10
|
+
And a file named "features/support/hooks.rb" with:
|
11
|
+
"""
|
12
|
+
Before('~@no-boom') do
|
13
|
+
raise 'boom'
|
14
|
+
end
|
15
|
+
"""
|
16
|
+
And a file named "features/f.feature" with:
|
17
|
+
"""
|
18
|
+
Feature: With and without hooks
|
19
|
+
Scenario: using hook
|
20
|
+
Given this step works
|
21
|
+
|
22
|
+
@no-boom
|
23
|
+
Scenario: omitting hook
|
24
|
+
Given this step works
|
25
|
+
"""
|
26
|
+
|
27
|
+
Scenario: omit tagged hook
|
28
|
+
When I run cucumber features/f.feature:2
|
29
|
+
Then it should fail with
|
30
|
+
"""
|
31
|
+
Feature: With and without hooks
|
32
|
+
|
33
|
+
Scenario: using hook # features/f.feature:2
|
34
|
+
boom (RuntimeError)
|
35
|
+
./features/support/hooks.rb:2:in `Before'
|
36
|
+
Given this step works # features/step_definitions/steps.rb:1
|
37
|
+
|
38
|
+
Failing Scenarios:
|
39
|
+
cucumber features/f.feature:2 # Scenario: using hook
|
40
|
+
|
41
|
+
1 scenario (1 failed)
|
42
|
+
1 step (1 skipped)
|
43
|
+
|
44
|
+
"""
|
45
|
+
|
46
|
+
Scenario: omit tagged hook
|
47
|
+
When I run cucumber features/f.feature:6
|
48
|
+
Then it should pass with
|
49
|
+
"""
|
50
|
+
Feature: With and without hooks
|
51
|
+
|
52
|
+
@no-boom
|
53
|
+
Scenario: omitting hook # features/f.feature:6
|
54
|
+
Given this step works # features/step_definitions/steps.rb:1
|
55
|
+
|
56
|
+
1 scenario (1 passed)
|
57
|
+
1 step (1 passed)
|
58
|
+
|
59
|
+
"""
|
60
|
+
|
61
|
+
|
@@ -102,7 +102,7 @@ Then /^"([^\"]*)" should have the same contents as "([^\"]*)"$/ do |actual_file,
|
|
102
102
|
actual = IO.read(actual_file)
|
103
103
|
actual = replace_duration(actual, '0m30.005s')
|
104
104
|
# Comment out to replace expected file. Use with care!
|
105
|
-
File.open(expected_file, "w") {|io| io.write(actual)}
|
105
|
+
# File.open(expected_file, "w") {|io| io.write(actual)}
|
106
106
|
actual.should == IO.read(expected_file)
|
107
107
|
end
|
108
108
|
|
data/features/transform.feature
CHANGED
@@ -3,22 +3,98 @@ Feature: transform
|
|
3
3
|
As a step definition editor
|
4
4
|
I want to register a regex to capture and tranform step definition arguments.
|
5
5
|
|
6
|
+
Background:
|
7
|
+
Given a standard Cucumber project directory structure
|
8
|
+
And a file named "features/step_definitions/steps.rb" with:
|
9
|
+
"""
|
10
|
+
Then /^I should transform ('\d+' to an Integer)$/ do |integer|
|
11
|
+
integer.should be_kind_of(Integer)
|
12
|
+
end
|
13
|
+
|
14
|
+
Then /^I should transform ('\w+' to a Symbol)$/ do |symbol|
|
15
|
+
symbol.should be_kind_of(Symbol)
|
16
|
+
end
|
17
|
+
|
18
|
+
Then /^I should transform ('\d+' to a Float)$/ do |float|
|
19
|
+
float.should be_kind_of(Float)
|
20
|
+
end
|
21
|
+
|
22
|
+
Then /^I should transform ('\w+' to an Array)$/ do |array|
|
23
|
+
array.should be_kind_of(Array)
|
24
|
+
end
|
25
|
+
|
26
|
+
Then /^I should not transform ('\d+') to an Integer$/ do |string|
|
27
|
+
string.should be_kind_of(String)
|
28
|
+
end
|
29
|
+
"""
|
30
|
+
And a file named "features/support/env.rb" with:
|
31
|
+
"""
|
32
|
+
Transform /^'\d+' to an Integer$/ do |step_arg|
|
33
|
+
/'(\d+)' to an Integer/.match(step_arg).captures[0].to_i
|
34
|
+
end
|
35
|
+
|
36
|
+
Transform /^'(\d+)' to a Float$/ do |integer_string|
|
37
|
+
Float.induced_from Transform("'#{integer_string}' to an Integer")
|
38
|
+
end
|
39
|
+
|
40
|
+
Transform(/^('\w+') to a Symbol$/) {|str| str.to_sym }
|
41
|
+
|
42
|
+
module MyHelpers
|
43
|
+
def fetch_array
|
44
|
+
@array
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
World(MyHelpers)
|
49
|
+
|
50
|
+
Before do
|
51
|
+
@array = []
|
52
|
+
end
|
53
|
+
|
54
|
+
Transform(/^('\w+') to an Array$/) {|str| fetch_array }
|
55
|
+
"""
|
56
|
+
|
6
57
|
Scenario: run a specific scenario with a registered transform
|
7
|
-
|
58
|
+
Given a file named "features/transform_sample.feature" with:
|
59
|
+
"""
|
60
|
+
Feature: Step argument transformations
|
61
|
+
|
62
|
+
Scenario: transform with matches
|
63
|
+
Then I should transform '10' to an Integer
|
64
|
+
|
65
|
+
Scenario: transform with matches that capture
|
66
|
+
Then I should transform 'abc' to a Symbol
|
67
|
+
|
68
|
+
Scenario: transform with matches that reuse transforms
|
69
|
+
Then I should transform '10' to a Float
|
70
|
+
|
71
|
+
Scenario: transform with matches that use current world
|
72
|
+
Then I should transform 'abc' to an Array
|
73
|
+
|
74
|
+
Scenario: transform without matches
|
75
|
+
Then I should not transform '10' to an Integer
|
76
|
+
"""
|
77
|
+
When I run cucumber -s features
|
8
78
|
Then it should pass with
|
9
|
-
|
10
|
-
|
79
|
+
"""
|
80
|
+
Feature: Step argument transformations
|
11
81
|
|
12
|
-
|
13
|
-
|
82
|
+
Scenario: transform with matches
|
83
|
+
Then I should transform '10' to an Integer
|
84
|
+
|
85
|
+
Scenario: transform with matches that capture
|
86
|
+
Then I should transform 'abc' to a Symbol
|
87
|
+
|
88
|
+
Scenario: transform with matches that reuse transforms
|
89
|
+
Then I should transform '10' to a Float
|
14
90
|
|
15
|
-
|
16
|
-
|
91
|
+
Scenario: transform with matches that use current world
|
92
|
+
Then I should transform 'abc' to an Array
|
17
93
|
|
18
|
-
|
19
|
-
|
94
|
+
Scenario: transform without matches
|
95
|
+
Then I should not transform '10' to an Integer
|
20
96
|
|
21
|
-
|
22
|
-
|
97
|
+
5 scenarios (5 passed)
|
98
|
+
5 steps (5 passed)
|
23
99
|
|
24
|
-
|
100
|
+
"""
|