cucumber 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -1
- data/LICENSE +1 -1
- data/Rakefile +5 -51
- data/bin/cucumber +7 -1
- data/cucumber.gemspec +463 -679
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +4 -7
- data/examples/i18n/ru/features/division.feature +2 -2
- data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
- data/examples/sinatra/features/support/env.rb +2 -5
- data/examples/v8/features/fibonacci.feature +1 -1
- data/examples/watir/features/step_definitions/search_steps.rb +1 -1
- data/features/background.feature +284 -95
- data/features/custom_formatter.feature +3 -73
- data/features/json_formatter.feature +160 -245
- data/features/step_definitions/cucumber_steps.rb +7 -153
- data/features/support/env.rb +18 -140
- data/fixtures/junit/features/pending.feature +3 -1
- data/fixtures/self_test/features/support/env.rb +8 -0
- data/fixtures/tickets/features.html +1 -1
- data/gem_tasks/examples.rake +1 -1
- data/lib/cucumber.rb +12 -0
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +21 -5
- data/lib/cucumber/ast/examples.rb +12 -4
- data/lib/cucumber/ast/feature.rb +13 -5
- data/lib/cucumber/ast/feature_element.rb +9 -4
- data/lib/cucumber/ast/outline_table.rb +4 -4
- data/lib/cucumber/ast/scenario.rb +7 -5
- data/lib/cucumber/ast/scenario_outline.rb +23 -15
- data/lib/cucumber/ast/step.rb +5 -0
- data/lib/cucumber/ast/step_invocation.rb +21 -15
- data/lib/cucumber/ast/table.rb +14 -8
- data/lib/cucumber/ast/tree_walker.rb +10 -48
- data/lib/cucumber/cli/configuration.rb +33 -8
- data/lib/cucumber/cli/main.rb +20 -35
- data/lib/cucumber/cli/options.rb +8 -7
- data/lib/cucumber/cli/profile_loader.rb +2 -0
- data/lib/cucumber/core_ext/proc.rb +2 -1
- data/lib/cucumber/feature_file.rb +47 -15
- data/lib/cucumber/formatter/ansicolor.rb +3 -5
- data/lib/cucumber/formatter/console.rb +27 -23
- data/lib/cucumber/formatter/cucumber.css +34 -17
- data/lib/cucumber/formatter/cucumber.sass +173 -182
- data/lib/cucumber/formatter/html.rb +46 -11
- data/lib/cucumber/formatter/io.rb +2 -4
- data/lib/cucumber/formatter/json.rb +15 -152
- data/lib/cucumber/formatter/json_pretty.rb +5 -6
- data/lib/cucumber/formatter/junit.rb +28 -22
- data/lib/cucumber/formatter/pdf.rb +6 -6
- data/lib/cucumber/formatter/pretty.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +22 -11
- data/lib/cucumber/formatter/unicode.rb +41 -20
- data/lib/cucumber/js_support/js_dsl.js +4 -4
- data/lib/cucumber/js_support/js_language.rb +9 -5
- data/lib/cucumber/js_support/js_snippets.rb +2 -2
- data/lib/cucumber/language_support.rb +2 -2
- data/lib/cucumber/parser/gherkin_builder.rb +35 -30
- data/lib/cucumber/platform.rb +8 -8
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +80 -31
- data/lib/cucumber/rb_support/rb_dsl.rb +1 -0
- data/lib/cucumber/rb_support/rb_language.rb +10 -8
- data/lib/cucumber/rb_support/rb_step_definition.rb +8 -0
- data/lib/cucumber/rb_support/rb_transform.rb +17 -0
- data/lib/cucumber/rb_support/rb_world.rb +26 -18
- data/lib/cucumber/rspec/doubles.rb +3 -3
- data/lib/cucumber/step_match.rb +6 -2
- data/lib/cucumber/step_mother.rb +6 -427
- data/lib/cucumber/wire_support/configuration.rb +4 -1
- data/lib/cucumber/wire_support/wire_language.rb +3 -10
- data/spec/cucumber/ast/background_spec.rb +68 -6
- data/spec/cucumber/ast/feature_factory.rb +5 -4
- data/spec/cucumber/ast/feature_spec.rb +4 -4
- data/spec/cucumber/ast/outline_table_spec.rb +1 -1
- data/spec/cucumber/ast/scenario_outline_spec.rb +15 -11
- data/spec/cucumber/ast/scenario_spec.rb +4 -4
- data/spec/cucumber/ast/step_spec.rb +3 -3
- data/spec/cucumber/ast/table_spec.rb +38 -2
- data/spec/cucumber/ast/tree_walker_spec.rb +2 -2
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +32 -6
- data/spec/cucumber/cli/drb_client_spec.rb +2 -3
- data/spec/cucumber/cli/main_spec.rb +43 -43
- data/spec/cucumber/cli/options_spec.rb +28 -1
- data/spec/cucumber/cli/profile_loader_spec.rb +1 -1
- data/spec/cucumber/core_ext/proc_spec.rb +1 -1
- data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
- data/spec/cucumber/formatter/duration_spec.rb +1 -1
- data/spec/cucumber/formatter/html_spec.rb +3 -5
- data/spec/cucumber/formatter/junit_spec.rb +16 -2
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +11 -12
- data/spec/cucumber/rb_support/rb_language_spec.rb +241 -28
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +33 -28
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +1 -1
- data/spec/cucumber/step_match_spec.rb +11 -9
- data/spec/cucumber/wire_support/configuration_spec.rb +1 -1
- data/spec/cucumber/wire_support/connection_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_exception_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_language_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_packet_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/cucumber/world/pending_spec.rb +2 -2
- data/spec/spec_helper.rb +13 -20
- metadata +11 -222
- data/.gitignore +0 -20
- data/Caliper.yml +0 -4
- data/History.txt +0 -1552
- data/README.rdoc +0 -26
- data/VERSION.yml +0 -5
- data/examples/i18n/ro/features/suma.feature +0 -11
- data/features/announce.feature +0 -164
- data/features/around_hooks.feature +0 -232
- data/features/bug_371.feature +0 -32
- data/features/bug_464.feature +0 -16
- data/features/bug_475.feature +0 -42
- data/features/bug_585_tab_indentation.feature +0 -22
- data/features/bug_600.feature +0 -67
- data/features/call_steps_from_stepdefs.feature +0 -154
- data/features/cucumber_cli.feature +0 -591
- data/features/cucumber_cli_outlines.feature +0 -117
- data/features/default_snippets.feature +0 -42
- data/features/diffing.feature +0 -25
- data/features/drb_server_integration.feature +0 -174
- data/features/exception_in_after_block.feature +0 -127
- data/features/exception_in_after_step_block.feature +0 -104
- data/features/exception_in_before_block.feature +0 -98
- data/features/exclude_files.feature +0 -20
- data/features/expand.feature +0 -60
- data/features/html_formatter.feature +0 -8
- data/features/html_formatter/a.html +0 -582
- data/features/junit_formatter.feature +0 -88
- data/features/language_from_header.feature +0 -30
- data/features/language_help.feature +0 -78
- data/features/listener_debugger_formatter.feature +0 -42
- data/features/multiline_names.feature +0 -44
- data/features/negative_tagged_hooks.feature +0 -60
- data/features/post_configuration_hook.feature +0 -37
- data/features/profiles.feature +0 -126
- data/features/rake_task.feature +0 -152
- data/features/report_called_undefined_steps.feature +0 -34
- data/features/rerun_formatter.feature +0 -45
- data/features/simplest.feature +0 -11
- data/features/snippet.feature +0 -23
- data/features/snippets_when_using_star_keyword.feature +0 -36
- data/features/step_definitions/extra_steps.rb +0 -2
- data/features/step_definitions/simplest_steps.rb +0 -3
- data/features/step_definitions/wire_steps.rb +0 -32
- data/features/support/env.rb.simplest +0 -7
- data/features/support/fake_wire_server.rb +0 -77
- data/features/table_diffing.feature +0 -45
- data/features/table_mapping.feature +0 -34
- data/features/tag_logic.feature +0 -258
- data/features/transform.feature +0 -245
- data/features/unicode_table.feature +0 -35
- data/features/usage_and_stepdefs_formatter.feature +0 -169
- data/features/wire_protocol.feature +0 -332
- data/features/wire_protocol_table_diffing.feature +0 -119
- data/features/wire_protocol_tags.feature +0 -87
- data/features/wire_protocol_timeouts.feature +0 -63
- data/features/work_in_progress.feature +0 -156
- data/fixtures/json/features/pystring.feature +0 -8
- data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +0 -12
- data/fixtures/self_test/features/background/background_with_name.feature +0 -7
- data/fixtures/self_test/features/background/failing_background.feature +0 -12
- data/fixtures/self_test/features/background/failing_background_after_success.feature +0 -11
- data/fixtures/self_test/features/background/multiline_args_background.feature +0 -32
- data/fixtures/self_test/features/background/passing_background.feature +0 -10
- data/fixtures/self_test/features/background/pending_background.feature +0 -10
- data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +0 -16
- data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +0 -16
- data/gem_tasks/features.rake +0 -14
- data/gem_tasks/sdoc.rake +0 -12
- data/lib/cucumber/ast/py_string.rb +0 -80
- data/lib/cucumber/formatter/color_io.rb +0 -23
- data/lib/cucumber/formatter/tag_cloud.rb +0 -35
- data/spec/cucumber/ast/py_string_spec.rb +0 -40
- data/spec/cucumber/formatter/color_io_spec.rb +0 -29
- data/spec/cucumber/step_mother_spec.rb +0 -302
data/README.rdoc
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
= Cucumber
|
2
|
-
|
3
|
-
The main website is at http://cukes.info/
|
4
|
-
The documentation is at http://wiki.github.com/aslakhellesoy/cucumber/
|
5
|
-
|
6
|
-
== Note on Patches/Pull Requests
|
7
|
-
|
8
|
-
* Fork the project.
|
9
|
-
* Make your feature addition or bug fix.
|
10
|
-
* Add tests for it. This is important so I don't break it in a
|
11
|
-
future version unintentionally.
|
12
|
-
* Commit, do not mess with Rakefile, version, or history.
|
13
|
-
(if you want to have your own version, that is fine but
|
14
|
-
bump version in a commit by itself I can ignore when I pull)
|
15
|
-
* Send me a pull request. Bonus points for topic branches.
|
16
|
-
|
17
|
-
== Running tests
|
18
|
-
|
19
|
-
rake
|
20
|
-
|
21
|
-
If you get errors about missing gems - just install them.
|
22
|
-
|
23
|
-
== Copyright
|
24
|
-
|
25
|
-
Copyright (c) 2008,2009 Aslak Hellesøy. See LICENSE for details.
|
26
|
-
|
data/VERSION.yml
DELETED
data/features/announce.feature
DELETED
@@ -1,164 +0,0 @@
|
|
1
|
-
Feature: Delayed announcement
|
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 /^I use announce with text "(.*)"$/ do |ann| x=1
|
8
|
-
announce(ann)
|
9
|
-
end
|
10
|
-
|
11
|
-
Given /^I use multiple announces$/ do x=1
|
12
|
-
announce("Multiple")
|
13
|
-
announce(["Announce","Me"])
|
14
|
-
end
|
15
|
-
|
16
|
-
Given /^I use announcement (.+) in line (.+) (?:with result (.+))$/ do |ann, line, result| x=1
|
17
|
-
announce("Last announcement") if line == "3"
|
18
|
-
announce("Line: #{line}: #{ann}")
|
19
|
-
fail if result =~ /fail/i
|
20
|
-
end
|
21
|
-
|
22
|
-
Given /^I use announce and step fails$/ do x=1
|
23
|
-
announce("Announce with fail")
|
24
|
-
fail
|
25
|
-
end
|
26
|
-
|
27
|
-
Given /^this step works$/ do x=1
|
28
|
-
end
|
29
|
-
|
30
|
-
Given /^I announce the world$/ do x=1
|
31
|
-
announce_world
|
32
|
-
end
|
33
|
-
"""
|
34
|
-
And a file named "features/f.feature" with:
|
35
|
-
"""
|
36
|
-
Feature: F
|
37
|
-
|
38
|
-
Scenario: S
|
39
|
-
Given I use announce with text "Ann"
|
40
|
-
And this step works
|
41
|
-
|
42
|
-
Scenario: S2
|
43
|
-
Given I use multiple announces
|
44
|
-
And this step works
|
45
|
-
|
46
|
-
Scenario Outline: S3
|
47
|
-
Given I use announcement <ann> in line <line>
|
48
|
-
|
49
|
-
Examples:
|
50
|
-
| line | ann |
|
51
|
-
| 1 | anno1 |
|
52
|
-
| 2 | anno2 |
|
53
|
-
| 3 | anno3 |
|
54
|
-
|
55
|
-
Scenario: S4
|
56
|
-
Given I use announce and step fails
|
57
|
-
And this step works
|
58
|
-
|
59
|
-
Scenario Outline: s5
|
60
|
-
Given I use announcement <ann> in line <line> with result <result>
|
61
|
-
|
62
|
-
Examples:
|
63
|
-
| line | ann | result |
|
64
|
-
| 1 | anno1 | fail |
|
65
|
-
| 2 | anno2 | pass |
|
66
|
-
"""
|
67
|
-
|
68
|
-
And a file named "features/announce_world.feature" with:
|
69
|
-
"""
|
70
|
-
Feature: announce_world
|
71
|
-
Scenario: announce_world
|
72
|
-
Given I announce the world
|
73
|
-
"""
|
74
|
-
|
75
|
-
Scenario: Delayed announcements feature
|
76
|
-
When I run cucumber --format pretty features/f.feature
|
77
|
-
Then STDERR should be empty
|
78
|
-
And the output should contain
|
79
|
-
"""
|
80
|
-
Feature: F
|
81
|
-
|
82
|
-
Scenario: S # features/f.feature:3
|
83
|
-
Given I use announce with text "Ann" # features/step_definitions/steps.rb:1
|
84
|
-
Ann
|
85
|
-
And this step works # features/step_definitions/steps.rb:21
|
86
|
-
|
87
|
-
Scenario: S2 # features/f.feature:7
|
88
|
-
Given I use multiple announces # features/step_definitions/steps.rb:5
|
89
|
-
Multiple
|
90
|
-
Announce
|
91
|
-
Me
|
92
|
-
And this step works # features/step_definitions/steps.rb:21
|
93
|
-
|
94
|
-
Scenario Outline: S3 # features/f.feature:11
|
95
|
-
Given I use announcement <ann> in line <line> # features/f.feature:12
|
96
|
-
|
97
|
-
Examples:
|
98
|
-
| line | ann |
|
99
|
-
| 1 | anno1 |
|
100
|
-
| 2 | anno2 |
|
101
|
-
| 3 | anno3 |
|
102
|
-
|
103
|
-
Scenario: S4 # features/f.feature:20
|
104
|
-
Given I use announce and step fails # features/step_definitions/steps.rb:16
|
105
|
-
Announce with fail
|
106
|
-
(RuntimeError)
|
107
|
-
./features/step_definitions/steps.rb:18:in `/^I use announce and step fails$/'
|
108
|
-
features/f.feature:21:in `Given I use announce and step fails'
|
109
|
-
And this step works # features/step_definitions/steps.rb:21
|
110
|
-
|
111
|
-
Scenario Outline: s5 # features/f.feature:24
|
112
|
-
Given I use announcement <ann> in line <line> with result <result> # features/step_definitions/steps.rb:10
|
113
|
-
|
114
|
-
Examples:
|
115
|
-
| line | ann | result |
|
116
|
-
| 1 | anno1 | fail | Line: 1: anno1
|
117
|
-
(RuntimeError)
|
118
|
-
./features/step_definitions/steps.rb:13:in `/^I use announcement (.+) in line (.+) (?:with result (.+))$/'
|
119
|
-
features/f.feature:25:in `Given I use announcement <ann> in line <line> with result <result>'
|
120
|
-
| 2 | anno2 | pass | Line: 2: anno2
|
121
|
-
"""
|
122
|
-
|
123
|
-
Scenario: Non-delayed announcements feature (progress formatter)
|
124
|
-
When I run cucumber --format progress features/f.feature
|
125
|
-
Then the output should contain
|
126
|
-
"""
|
127
|
-
Ann
|
128
|
-
..
|
129
|
-
Multiple
|
130
|
-
|
131
|
-
Announce
|
132
|
-
Me
|
133
|
-
..-UUUUUU
|
134
|
-
Announce with fail
|
135
|
-
F--
|
136
|
-
Line: 1: anno1
|
137
|
-
FFF
|
138
|
-
Line: 2: anno2
|
139
|
-
...
|
140
|
-
"""
|
141
|
-
|
142
|
-
@rspec2
|
143
|
-
Scenario: announce world
|
144
|
-
When I run cucumber --format progress features/announce_world.feature
|
145
|
-
Then the output should contain
|
146
|
-
"""
|
147
|
-
WORLD:
|
148
|
-
Object
|
149
|
-
|
150
|
-
RSpec::Matchers
|
151
|
-
Cucumber::RbSupport::RbWorld
|
152
|
-
"""
|
153
|
-
|
154
|
-
@rspec1
|
155
|
-
Scenario: announce world
|
156
|
-
When I run cucumber --format progress features/announce_world.feature
|
157
|
-
Then the output should contain
|
158
|
-
"""
|
159
|
-
WORLD:
|
160
|
-
Object
|
161
|
-
|
162
|
-
Spec::Matchers
|
163
|
-
Cucumber::RbSupport::RbWorld
|
164
|
-
"""
|
@@ -1,232 +0,0 @@
|
|
1
|
-
Feature: Around hooks
|
2
|
-
In order to support transactional scenarios for database libraries
|
3
|
-
that provide only a block syntax for transactions, Cucumber should
|
4
|
-
permit definition of Around hooks.
|
5
|
-
|
6
|
-
Scenario: A single Around hook
|
7
|
-
Given a standard Cucumber project directory structure
|
8
|
-
And a file named "features/step_definitions/steps.rb" with:
|
9
|
-
"""
|
10
|
-
Then /^the hook is called$/ do
|
11
|
-
$hook_called.should == true
|
12
|
-
end
|
13
|
-
"""
|
14
|
-
And a file named "features/support/hooks.rb" with:
|
15
|
-
"""
|
16
|
-
Around do |scenario, block|
|
17
|
-
$hook_called = true
|
18
|
-
block.call
|
19
|
-
end
|
20
|
-
"""
|
21
|
-
And a file named "features/f.feature" with:
|
22
|
-
"""
|
23
|
-
Feature: Around hooks
|
24
|
-
Scenario: using hook
|
25
|
-
Then the hook is called
|
26
|
-
"""
|
27
|
-
When I run cucumber features/f.feature
|
28
|
-
Then it should pass with
|
29
|
-
"""
|
30
|
-
Feature: Around hooks
|
31
|
-
|
32
|
-
Scenario: using hook # features/f.feature:2
|
33
|
-
Then the hook is called # features/step_definitions/steps.rb:1
|
34
|
-
|
35
|
-
1 scenario (1 passed)
|
36
|
-
1 step (1 passed)
|
37
|
-
|
38
|
-
"""
|
39
|
-
|
40
|
-
Scenario: Multiple Around hooks
|
41
|
-
Given a standard Cucumber project directory structure
|
42
|
-
And a file named "features/step_definitions/steps.rb" with:
|
43
|
-
"""
|
44
|
-
Then /^the hooks are called in the correct order$/ do
|
45
|
-
$hooks_called.should == ['A', 'B', 'C']
|
46
|
-
end
|
47
|
-
"""
|
48
|
-
And a file named "features/support/hooks.rb" with:
|
49
|
-
"""
|
50
|
-
Around do |scenario, block|
|
51
|
-
$hooks_called ||= []
|
52
|
-
$hooks_called << 'A'
|
53
|
-
block.call
|
54
|
-
end
|
55
|
-
|
56
|
-
Around do |scenario, block|
|
57
|
-
$hooks_called ||= []
|
58
|
-
$hooks_called << 'B'
|
59
|
-
block.call
|
60
|
-
end
|
61
|
-
|
62
|
-
Around do |scenario, block|
|
63
|
-
$hooks_called ||= []
|
64
|
-
$hooks_called << 'C'
|
65
|
-
block.call
|
66
|
-
end
|
67
|
-
"""
|
68
|
-
And a file named "features/f.feature" with:
|
69
|
-
"""
|
70
|
-
Feature: Around hooks
|
71
|
-
Scenario: using multiple hooks
|
72
|
-
Then the hooks are called in the correct order
|
73
|
-
"""
|
74
|
-
When I run cucumber features/f.feature
|
75
|
-
Then it should pass with
|
76
|
-
"""
|
77
|
-
Feature: Around hooks
|
78
|
-
|
79
|
-
Scenario: using multiple hooks # features/f.feature:2
|
80
|
-
Then the hooks are called in the correct order # features/step_definitions/steps.rb:1
|
81
|
-
|
82
|
-
1 scenario (1 passed)
|
83
|
-
1 step (1 passed)
|
84
|
-
|
85
|
-
"""
|
86
|
-
|
87
|
-
Scenario: Mixing Around, Before, and After hooks
|
88
|
-
Given a standard Cucumber project directory structure
|
89
|
-
And a file named "features/step_definitions/steps.rb" with:
|
90
|
-
"""
|
91
|
-
Then /^the Around hook is called around Before and After hooks$/ do
|
92
|
-
$hooks_called.should == ['Around', 'Before']
|
93
|
-
end
|
94
|
-
"""
|
95
|
-
And a file named "features/support/hooks.rb" with:
|
96
|
-
"""
|
97
|
-
Around do |scenario, block|
|
98
|
-
$hooks_called ||= []
|
99
|
-
$hooks_called << 'Around'
|
100
|
-
block.call
|
101
|
-
$hooks_called << 'Around'
|
102
|
-
$hooks_called.should == ['Around', 'Before', 'After', 'Around']
|
103
|
-
end
|
104
|
-
|
105
|
-
Before do |scenario|
|
106
|
-
$hooks_called ||= []
|
107
|
-
$hooks_called << 'Before'
|
108
|
-
end
|
109
|
-
|
110
|
-
After do |scenario|
|
111
|
-
$hooks_called ||= []
|
112
|
-
$hooks_called << 'After'
|
113
|
-
$hooks_called.should == ['Around', 'Before', 'After']
|
114
|
-
end
|
115
|
-
"""
|
116
|
-
And a file named "features/f.feature" with:
|
117
|
-
"""
|
118
|
-
Feature: Around hooks
|
119
|
-
Scenario: Mixing Around, Before, and After hooks
|
120
|
-
Then the Around hook is called around Before and After hooks
|
121
|
-
"""
|
122
|
-
When I run cucumber features/f.feature
|
123
|
-
Then it should pass with
|
124
|
-
"""
|
125
|
-
Feature: Around hooks
|
126
|
-
|
127
|
-
Scenario: Mixing Around, Before, and After hooks # features/f.feature:2
|
128
|
-
Then the Around hook is called around Before and After hooks # features/step_definitions/steps.rb:1
|
129
|
-
|
130
|
-
1 scenario (1 passed)
|
131
|
-
1 step (1 passed)
|
132
|
-
|
133
|
-
"""
|
134
|
-
|
135
|
-
Scenario: Around hooks with tags
|
136
|
-
Given a standard Cucumber project directory structure
|
137
|
-
And a file named "features/step_definitions/steps.rb" with:
|
138
|
-
"""
|
139
|
-
Then /^the Around hooks with matching tags are called$/ do
|
140
|
-
$hooks_called.should == ['one', 'one or two']
|
141
|
-
end
|
142
|
-
"""
|
143
|
-
And a file named "features/support/hooks.rb" with:
|
144
|
-
"""
|
145
|
-
Around('@one') do |scenario, block|
|
146
|
-
$hooks_called ||= []
|
147
|
-
$hooks_called << 'one'
|
148
|
-
block.call
|
149
|
-
end
|
150
|
-
|
151
|
-
Around('@one,@two') do |scenario, block|
|
152
|
-
$hooks_called ||= []
|
153
|
-
$hooks_called << 'one or two'
|
154
|
-
block.call
|
155
|
-
end
|
156
|
-
|
157
|
-
Around('@one', '@two') do |scenario, block|
|
158
|
-
$hooks_called ||= []
|
159
|
-
$hooks_called << 'one and two'
|
160
|
-
block.call
|
161
|
-
end
|
162
|
-
|
163
|
-
Around('@two') do |scenario, block|
|
164
|
-
$hooks_called ||= []
|
165
|
-
$hooks_called << 'two'
|
166
|
-
block.call
|
167
|
-
end
|
168
|
-
"""
|
169
|
-
And a file named "features/f.feature" with:
|
170
|
-
"""
|
171
|
-
Feature: Around hooks
|
172
|
-
@one
|
173
|
-
Scenario: Around hooks with tags
|
174
|
-
Then the Around hooks with matching tags are called
|
175
|
-
"""
|
176
|
-
When I run cucumber -q -t @one features/f.feature
|
177
|
-
Then it should pass with
|
178
|
-
"""
|
179
|
-
Feature: Around hooks
|
180
|
-
|
181
|
-
@one
|
182
|
-
Scenario: Around hooks with tags
|
183
|
-
Then the Around hooks with matching tags are called
|
184
|
-
|
185
|
-
1 scenario (1 passed)
|
186
|
-
1 step (1 passed)
|
187
|
-
|
188
|
-
"""
|
189
|
-
|
190
|
-
Scenario: Around hooks with scenario outlines
|
191
|
-
Given a standard Cucumber project directory structure
|
192
|
-
And a file named "features/step_definitions/steps.rb" with:
|
193
|
-
"""
|
194
|
-
Then /^the hook is called$/ do
|
195
|
-
$hook_called.should == true
|
196
|
-
end
|
197
|
-
"""
|
198
|
-
And a file named "features/support/hooks.rb" with:
|
199
|
-
"""
|
200
|
-
Around do |scenario, block|
|
201
|
-
$hook_called = true
|
202
|
-
block.call
|
203
|
-
end
|
204
|
-
"""
|
205
|
-
And a file named "features/f.feature" with:
|
206
|
-
"""
|
207
|
-
Feature: Around hooks with scenario outlines
|
208
|
-
Scenario Outline: using hook
|
209
|
-
Then the hook is called
|
210
|
-
|
211
|
-
Examples:
|
212
|
-
| Number |
|
213
|
-
| one |
|
214
|
-
| two |
|
215
|
-
"""
|
216
|
-
When I run cucumber features/f.feature
|
217
|
-
Then it should pass with
|
218
|
-
"""
|
219
|
-
Feature: Around hooks with scenario outlines
|
220
|
-
|
221
|
-
Scenario Outline: using hook # features/f.feature:2
|
222
|
-
Then the hook is called # features/step_definitions/steps.rb:1
|
223
|
-
|
224
|
-
Examples:
|
225
|
-
| Number |
|
226
|
-
| one |
|
227
|
-
| two |
|
228
|
-
|
229
|
-
2 scenarios (2 passed)
|
230
|
-
2 steps (2 passed)
|
231
|
-
|
232
|
-
"""
|
data/features/bug_371.feature
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
Feature: https://rspec.lighthouseapp.com/projects/16211/tickets/371
|
2
|
-
Scenario: Before runs once
|
3
|
-
Given a standard Cucumber project directory structure
|
4
|
-
And a file named "features/f.feature" with:
|
5
|
-
"""
|
6
|
-
Feature: F
|
7
|
-
Scenario: S
|
8
|
-
Given G
|
9
|
-
"""
|
10
|
-
And a file named "features/step_definitions/steps.rb" with:
|
11
|
-
"""
|
12
|
-
Before do
|
13
|
-
puts "B"
|
14
|
-
end
|
15
|
-
Given /G/ do
|
16
|
-
puts "G"
|
17
|
-
end
|
18
|
-
"""
|
19
|
-
When I run cucumber -q --format pretty --format progress --out progress.txt features/f.feature
|
20
|
-
Then it should pass with
|
21
|
-
"""
|
22
|
-
Feature: F
|
23
|
-
|
24
|
-
Scenario: S
|
25
|
-
B
|
26
|
-
G
|
27
|
-
Given G
|
28
|
-
|
29
|
-
1 scenario (1 passed)
|
30
|
-
1 step (1 passed)
|
31
|
-
|
32
|
-
"""
|