cucumber 0.3.104 → 0.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +50 -3
- data/Manifest.txt +20 -2
- data/Rakefile +4 -0
- data/config/hoe.rb +20 -14
- data/examples/i18n/tr/Rakefile +6 -0
- data/examples/i18n/tr/features/bo/314/210lme.feature +10 -0
- data/examples/i18n/tr/features/step_definitons/hesap_makinesi_ad/304/261mlar/304/261.rb +24 -0
- data/examples/i18n/tr/features/toplama.feature +18 -0
- data/examples/i18n/tr/lib/hesap_makinesi.rb +15 -0
- data/examples/python/features/step_definitions/fib_steps.py +9 -1
- data/examples/ruby2python/features/fibonacci.feature +19 -0
- data/examples/{python → ruby2python}/features/step_definitions/fib_steps.rb +0 -0
- data/examples/ruby2python/features/support/env.rb +21 -0
- data/examples/ruby2python/lib/fib.py +7 -0
- data/features/bug_475.feature +43 -0
- data/features/exception_in_before_block.feature +34 -1
- data/features/html_formatter.feature +1 -1
- data/features/language_help.feature +68 -0
- data/features/rake_task.feature +34 -60
- data/features/simplest.feature +11 -0
- data/features/step_definitions/simplest_steps.rb +6 -0
- data/features/support/env.rb +1 -1
- data/features/support/env.rb.simplest +7 -0
- data/features/table_diffing.feature +1 -1
- data/features/table_mapping.feature +35 -0
- data/features/transform.feature +133 -2
- data/features/usage_and_stepdefs_formatter.feature +4 -2
- data/gem_tasks/contributors.rake +2 -1
- data/lib/cucumber/ast/background.rb +17 -5
- data/lib/cucumber/ast/outline_table.rb +8 -1
- data/lib/cucumber/ast/scenario.rb +2 -1
- data/lib/cucumber/ast/step.rb +6 -1
- data/lib/cucumber/ast/step_invocation.rb +14 -1
- data/lib/cucumber/ast/table.rb +30 -6
- data/lib/cucumber/cli/configuration.rb +1 -1
- data/lib/cucumber/cli/language_help_formatter.rb +27 -14
- data/lib/cucumber/cli/options.rb +2 -1
- data/lib/cucumber/cli/profile_loader.rb +12 -4
- data/lib/cucumber/core_ext/instance_exec.rb +29 -25
- data/lib/cucumber/formatter/junit.rb +50 -45
- data/lib/cucumber/formatter/pdf.rb +16 -4
- data/lib/cucumber/formatter/usage.rb +2 -14
- data/lib/cucumber/language_support/language_methods.rb +23 -3
- data/lib/cucumber/languages.yml +14 -0
- data/lib/cucumber/parser/natural_language.rb +1 -1
- data/lib/cucumber/parser/table.rb +10 -7
- data/lib/cucumber/parser/table.tt +1 -1
- data/lib/cucumber/platform.rb +1 -0
- data/lib/cucumber/py_support/py_dsl.py +10 -8
- data/lib/cucumber/py_support/py_language.py +8 -0
- data/lib/cucumber/py_support/py_language.rb +24 -11
- data/lib/cucumber/rails/action_controller.rb +6 -1
- data/lib/cucumber/rails/active_record.rb +5 -4
- data/lib/cucumber/rake/task.rb +7 -82
- data/lib/cucumber/rb_support/rb_language.rb +0 -4
- data/lib/cucumber/rb_support/rb_step_definition.rb +4 -6
- data/lib/cucumber/rb_support/rb_transform.rb +9 -7
- data/lib/cucumber/step_definition_light.rb +20 -0
- data/lib/cucumber/step_match.rb +1 -1
- data/lib/cucumber/step_mother.rb +5 -1
- data/lib/cucumber/version.rb +3 -3
- data/lib/cucumber/webrat/element_locator.rb +2 -0
- data/rails_generators/cucumber/cucumber_generator.rb +8 -9
- data/rails_generators/cucumber/templates/cucumber +14 -6
- data/rails_generators/cucumber/templates/cucumber.rake +9 -1
- data/rails_generators/cucumber/templates/cucumber_environment.rb +5 -1
- data/rails_generators/cucumber/templates/env.rb +29 -14
- data/rails_generators/cucumber/templates/paths.rb +1 -1
- data/rails_generators/cucumber/templates/spork_env.rb +39 -17
- data/rails_generators/cucumber/templates/version_check.rb +29 -0
- data/rails_generators/cucumber/templates/webrat_steps.rb +5 -0
- data/spec/cucumber/ast/outline_table_spec.rb +21 -0
- data/spec/cucumber/ast/table_spec.rb +18 -0
- data/spec/cucumber/formatter/html_spec.rb +33 -69
- data/spec/cucumber/formatter/junit_spec.rb +73 -0
- data/spec/cucumber/formatter/spec_helper.rb +50 -0
- data/spec/cucumber/parser/table_parser_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +10 -1
- data/spec/cucumber/step_mother_spec.rb +6 -0
- metadata +32 -8
- data/examples/python/features/support/env.rb +0 -21
@@ -4,4 +4,4 @@ Feature: HTML formatter
|
|
4
4
|
|
5
5
|
Scenario: Everything in examples/self_test
|
6
6
|
When I run cucumber -q --format html --out tmp/a.html features
|
7
|
-
Then "examples/self_test/tmp/a.html" should have the same contents as "features/html_formatter/a.html"
|
7
|
+
Then "examples/self_test/tmp/a.html" should have the same contents as "features/html_formatter/a.html"
|
@@ -0,0 +1,68 @@
|
|
1
|
+
Feature: Language help
|
2
|
+
In order to figure out the keywords to use for a language
|
3
|
+
I want to be able to get help on the language from the CLI
|
4
|
+
|
5
|
+
Scenario: Get help for Portuguese language
|
6
|
+
When I run cucumber -l pt help
|
7
|
+
Then it should pass with
|
8
|
+
"""
|
9
|
+
| name | 'Portuguese' |
|
10
|
+
| native | 'português' |
|
11
|
+
| encoding | 'UTF-8' |
|
12
|
+
| space_after_keyword | 'true' |
|
13
|
+
| feature | 'Funcionalidade' |
|
14
|
+
| background | 'Contexto' |
|
15
|
+
| scenario | 'Cenário' / 'Cenario' |
|
16
|
+
| scenario_outline | 'Esquema do Cenário' / 'Esquema do Cenario' |
|
17
|
+
| examples | 'Exemplos' |
|
18
|
+
| given | 'Dado' |
|
19
|
+
| when | 'Quando' |
|
20
|
+
| then | 'Então' / 'Entao' |
|
21
|
+
| and | 'E' |
|
22
|
+
| but | 'Mas' |
|
23
|
+
|
24
|
+
"""
|
25
|
+
Scenario: List languages
|
26
|
+
When I run cucumber -l help
|
27
|
+
Then it should pass with
|
28
|
+
"""
|
29
|
+
| ar | Arabic | العربية |
|
30
|
+
| bg | Bulgarian | български |
|
31
|
+
| cat | Catalan | català |
|
32
|
+
| cy | Welsh | Cymraeg |
|
33
|
+
| cz | Czech | Česky |
|
34
|
+
| da | Danish | dansk |
|
35
|
+
| de | German | Deutsch |
|
36
|
+
| en | English | English |
|
37
|
+
| en-au | Australian | Australian |
|
38
|
+
| en-lol | LOLCAT | LOLCAT |
|
39
|
+
| en-tx | Texan | Texan |
|
40
|
+
| es | Spanish | español |
|
41
|
+
| et | Estonian | eesti keel |
|
42
|
+
| fi | Finnish | suomi |
|
43
|
+
| fr | French | français |
|
44
|
+
| he | Hebrew | עברית |
|
45
|
+
| hr | Croatian | hrvatski |
|
46
|
+
| hu | Hungarian | magyar |
|
47
|
+
| id | Indonesian | Bahasa Indonesia |
|
48
|
+
| it | Italian | italiano |
|
49
|
+
| ja | Japanese | 日本語 |
|
50
|
+
| ko | Korean | 한국어 |
|
51
|
+
| lt | Lithuanian | lietuvių kalba |
|
52
|
+
| lv | Latvian | latviešu |
|
53
|
+
| nl | Dutch | Nederlands |
|
54
|
+
| no | Norwegian | norsk |
|
55
|
+
| pl | Polish | polski |
|
56
|
+
| pt | Portuguese | português |
|
57
|
+
| ro | Romanian | română |
|
58
|
+
| ro2 | Romanian (diacritical) | română (diacritical) |
|
59
|
+
| ru | Russian | русский |
|
60
|
+
| se | Swedish | Svenska |
|
61
|
+
| sk | Slovak | Slovensky |
|
62
|
+
| tr | Turkish | Türkçe |
|
63
|
+
| uz | Uzbek | Узбекча |
|
64
|
+
| vi | Vietnamese | Tiếng Việt |
|
65
|
+
| zh-CN | Chinese simplified | 简体中文 |
|
66
|
+
| zh-TW | Chinese traditional | 繁體中文 |
|
67
|
+
|
68
|
+
"""
|
data/features/rake_task.feature
CHANGED
@@ -27,11 +27,11 @@ Feature: Rake task
|
|
27
27
|
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
28
28
|
require 'cucumber/rake/task'
|
29
29
|
|
30
|
-
Cucumber::Rake::Task.new
|
30
|
+
Cucumber::Rake::Task.new do |t|
|
31
31
|
t.profile = "foo"
|
32
32
|
end
|
33
33
|
"""
|
34
|
-
When I run rake
|
34
|
+
When I run rake cucumber
|
35
35
|
Then it should pass
|
36
36
|
And the output should contain
|
37
37
|
"""
|
@@ -44,6 +44,32 @@ Feature: Rake task
|
|
44
44
|
1 step (1 undefined)
|
45
45
|
"""
|
46
46
|
|
47
|
+
Scenario: rake task without a profile
|
48
|
+
Given a file named "Rakefile" with:
|
49
|
+
"""
|
50
|
+
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
51
|
+
require 'cucumber/rake/task'
|
52
|
+
|
53
|
+
Cucumber::Rake::Task.new do |t|
|
54
|
+
t.cucumber_opts = %w{--quiet --no-color}
|
55
|
+
end
|
56
|
+
"""
|
57
|
+
When I run rake cucumber
|
58
|
+
Then it should pass
|
59
|
+
And the output should contain
|
60
|
+
"""
|
61
|
+
Feature: Sample
|
62
|
+
|
63
|
+
Scenario: Wanted
|
64
|
+
Given I want to run this
|
65
|
+
|
66
|
+
Scenario: Unwanted
|
67
|
+
Given I don't want this ran
|
68
|
+
|
69
|
+
2 scenarios (2 undefined)
|
70
|
+
2 steps (2 undefined)
|
71
|
+
"""
|
72
|
+
|
47
73
|
Scenario: rake task with a defined profile and cucumber_opts
|
48
74
|
Given the following profile is defined:
|
49
75
|
"""
|
@@ -54,12 +80,12 @@ Feature: Rake task
|
|
54
80
|
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
55
81
|
require 'cucumber/rake/task'
|
56
82
|
|
57
|
-
Cucumber::Rake::Task.new
|
83
|
+
Cucumber::Rake::Task.new do |t|
|
58
84
|
t.profile = "bar"
|
59
85
|
t.cucumber_opts = %w{--quiet --no-color}
|
60
86
|
end
|
61
87
|
"""
|
62
|
-
When I run rake
|
88
|
+
When I run rake cucumber
|
63
89
|
Then it should pass
|
64
90
|
And the output should contain
|
65
91
|
"""
|
@@ -72,58 +98,6 @@ Feature: Rake task
|
|
72
98
|
1 step (1 undefined)
|
73
99
|
"""
|
74
100
|
|
75
|
-
Scenario: rake task with a defined profile and feature list
|
76
|
-
Given a file named "features/the_one_i_want_to_run.feature" with:
|
77
|
-
"""
|
78
|
-
Feature: Desired
|
79
|
-
|
80
|
-
Scenario: Something
|
81
|
-
Given this is missing
|
82
|
-
"""
|
83
|
-
Given the following profile is defined:
|
84
|
-
"""
|
85
|
-
baz: ['--quiet', '--no-color']
|
86
|
-
"""
|
87
|
-
And a file named "Rakefile" with:
|
88
|
-
"""
|
89
|
-
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
90
|
-
require 'cucumber/rake/task'
|
91
|
-
|
92
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
93
|
-
t.profile = "baz"
|
94
|
-
t.feature_list = ['features/the_one_i_want_to_run.feature']
|
95
|
-
end
|
96
|
-
"""
|
97
|
-
When I run rake features
|
98
|
-
Then it should pass
|
99
|
-
And the output should contain
|
100
|
-
"""
|
101
|
-
Feature: Desired
|
102
|
-
|
103
|
-
Scenario: Something
|
104
|
-
Given this is missing
|
105
|
-
|
106
|
-
1 scenario (1 undefined)
|
107
|
-
1 step (1 undefined)
|
108
|
-
"""
|
109
|
-
|
110
|
-
Scenario: deprecation warnings
|
111
|
-
Given a file named "Rakefile" with:
|
112
|
-
"""
|
113
|
-
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
114
|
-
require 'cucumber/rake/task'
|
115
|
-
|
116
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
117
|
-
t.feature_list = ['features/missing_step_definitions.feature']
|
118
|
-
end
|
119
|
-
"""
|
120
|
-
When I run rake features
|
121
|
-
Then it should pass
|
122
|
-
And STDERR should match
|
123
|
-
"""
|
124
|
-
Cucumber::Rake::Task#feature_list is deprecated and will be removed in 0.4.0. Please use profiles for complex settings: http://wiki.github.com/aslakhellesoy/cucumber/using-rake#profiles
|
125
|
-
"""
|
126
|
-
|
127
101
|
Scenario: respect requires
|
128
102
|
Given a file named "features/support/env.rb"
|
129
103
|
And a file named "features/support/dont_require_me.rb"
|
@@ -136,13 +110,13 @@ Feature: Rake task
|
|
136
110
|
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
137
111
|
require 'cucumber/rake/task'
|
138
112
|
|
139
|
-
Cucumber::Rake::Task.new
|
113
|
+
Cucumber::Rake::Task.new do |t|
|
140
114
|
t.profile = "no_bomb"
|
141
115
|
t.cucumber_opts = %w{--quiet --no-color}
|
142
116
|
end
|
143
117
|
"""
|
144
118
|
|
145
|
-
When I run rake
|
119
|
+
When I run rake cucumber
|
146
120
|
Then it should pass
|
147
121
|
And the output should not contain
|
148
122
|
"""
|
@@ -162,11 +136,11 @@ Feature: Rake task
|
|
162
136
|
$LOAD_PATH.unshift(CUCUMBER_LIB)
|
163
137
|
require 'cucumber/rake/task'
|
164
138
|
|
165
|
-
Cucumber::Rake::Task.new
|
139
|
+
Cucumber::Rake::Task.new do |t|
|
166
140
|
t.cucumber_opts = %w{--quiet --no-color}
|
167
141
|
end
|
168
142
|
"""
|
169
|
-
When I run rake
|
143
|
+
When I run rake cucumber
|
170
144
|
Then it should pass
|
171
145
|
And the output should contain
|
172
146
|
"""
|
data/features/support/env.rb
CHANGED
@@ -32,7 +32,7 @@ Feature: Table diffing
|
|
32
32
|
| x | y |
|
33
33
|
| a | b |
|
34
34
|
| a | c |
|
35
|
-
Tables were not identical (
|
35
|
+
Tables were not identical (Cucumber::Ast::Table::Different)
|
36
36
|
./features/step_definitions/table_steps.rb:2:in `/the table should be:/'
|
37
37
|
features/tables.feature:3:in `Then the table should be:'
|
38
38
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Table mapping
|
2
|
+
Scenario: Mapping table shouldn't change output
|
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 a table:
|
9
|
+
| who |
|
10
|
+
| aslak |
|
11
|
+
"""
|
12
|
+
And a file named "features/step_definitions/steps.rb" with:
|
13
|
+
"""
|
14
|
+
Given /a table:/ do |table|
|
15
|
+
table.map_headers!(/who/i => 'Who')
|
16
|
+
table.map_column!('Who') { |who| "Cuke" }
|
17
|
+
table.hashes[0]['Who'] = "Joe"
|
18
|
+
table.hashes.should == [{"Who"=>"Joe"}]
|
19
|
+
end
|
20
|
+
"""
|
21
|
+
When I run cucumber features/f.feature
|
22
|
+
Then STDERR should be empty
|
23
|
+
And it should pass with
|
24
|
+
"""
|
25
|
+
Feature: F
|
26
|
+
|
27
|
+
Scenario: S # features/f.feature:2
|
28
|
+
Given a table: # features/step_definitions/steps.rb:1
|
29
|
+
| who |
|
30
|
+
| aslak |
|
31
|
+
|
32
|
+
1 scenario (1 passed)
|
33
|
+
1 step (1 passed)
|
34
|
+
|
35
|
+
"""
|
data/features/transform.feature
CHANGED
@@ -23,6 +23,10 @@ Feature: transform
|
|
23
23
|
array.should be_kind_of(Array)
|
24
24
|
end
|
25
25
|
|
26
|
+
Then /^I should transform ('\w+' to Nil)$/ do |string|
|
27
|
+
string.should be_nil
|
28
|
+
end
|
29
|
+
|
26
30
|
Then /^I should not transform ('\d+') to an Integer$/ do |string|
|
27
31
|
string.should be_kind_of(String)
|
28
32
|
end
|
@@ -37,6 +41,8 @@ Feature: transform
|
|
37
41
|
Float.induced_from Transform("'#{integer_string}' to an Integer")
|
38
42
|
end
|
39
43
|
|
44
|
+
Transform(/^('\w+') to Nil$/) {|str| nil }
|
45
|
+
|
40
46
|
Transform(/^('\w+') to a Symbol$/) {|str| str.to_sym }
|
41
47
|
|
42
48
|
module MyHelpers
|
@@ -71,6 +77,9 @@ Feature: transform
|
|
71
77
|
Scenario: transform with matches that use current world
|
72
78
|
Then I should transform 'abc' to an Array
|
73
79
|
|
80
|
+
Scenario: transform with matches that return nil
|
81
|
+
Then I should transform 'nil' to Nil
|
82
|
+
|
74
83
|
Scenario: transform without matches
|
75
84
|
Then I should not transform '10' to an Integer
|
76
85
|
"""
|
@@ -91,10 +100,132 @@ Feature: transform
|
|
91
100
|
Scenario: transform with matches that use current world
|
92
101
|
Then I should transform 'abc' to an Array
|
93
102
|
|
103
|
+
Scenario: transform with matches that return nil
|
104
|
+
Then I should transform 'nil' to Nil
|
105
|
+
|
94
106
|
Scenario: transform without matches
|
95
107
|
Then I should not transform '10' to an Integer
|
96
108
|
|
97
|
-
|
98
|
-
|
109
|
+
6 scenarios (6 passed)
|
110
|
+
6 steps (6 passed)
|
99
111
|
|
100
112
|
"""
|
113
|
+
|
114
|
+
Scenario: run a table scenario with an unrelated registered transform
|
115
|
+
Given a file named "features/transform_sample.feature" with:
|
116
|
+
"""
|
117
|
+
Feature: Step argument transformations
|
118
|
+
|
119
|
+
Scenario: A table
|
120
|
+
Then I should check the following table:
|
121
|
+
| letter | letter_plus_a |
|
122
|
+
| r | ra |
|
123
|
+
| m | ma |
|
124
|
+
| p | pa |
|
125
|
+
"""
|
126
|
+
And a file named "features/support/table.rb" with:
|
127
|
+
"""
|
128
|
+
Transform /^table:number,number_plus_a$/ do |table|
|
129
|
+
:not_what_you_were_expecting
|
130
|
+
end
|
131
|
+
|
132
|
+
Then "I should check the following table:" do |table|
|
133
|
+
table.hashes.each do |hash|
|
134
|
+
hash['letter_plus_a'].should == (hash['letter'] + 'a')
|
135
|
+
end
|
136
|
+
end
|
137
|
+
"""
|
138
|
+
When I run cucumber -s features
|
139
|
+
Then it should pass with
|
140
|
+
"""
|
141
|
+
Feature: Step argument transformations
|
142
|
+
|
143
|
+
Scenario: A table
|
144
|
+
Then I should check the following table:
|
145
|
+
| letter | letter_plus_a |
|
146
|
+
| r | ra |
|
147
|
+
| m | ma |
|
148
|
+
| p | pa |
|
149
|
+
|
150
|
+
1 scenario (1 passed)
|
151
|
+
1 step (1 passed)
|
152
|
+
|
153
|
+
"""
|
154
|
+
|
155
|
+
Scenario: run a table scenario with an related registered transform not using table
|
156
|
+
Given a file named "features/transform_sample.feature" with:
|
157
|
+
"""
|
158
|
+
Feature: Step argument transformations
|
159
|
+
|
160
|
+
Scenario: A table
|
161
|
+
Then I should check the following table:
|
162
|
+
| letter | letter_plus_a |
|
163
|
+
| r | ra |
|
164
|
+
| m | ma |
|
165
|
+
| p | pa |
|
166
|
+
"""
|
167
|
+
And a file named "features/support/table.rb" with:
|
168
|
+
"""
|
169
|
+
Transform /^table:letter,letter_plus_a$/ do |table|
|
170
|
+
1
|
171
|
+
end
|
172
|
+
|
173
|
+
Then "I should check the following table:" do |columns|
|
174
|
+
columns.should == 1
|
175
|
+
end
|
176
|
+
"""
|
177
|
+
When I run cucumber -s features
|
178
|
+
Then it should pass with
|
179
|
+
"""
|
180
|
+
Feature: Step argument transformations
|
181
|
+
|
182
|
+
Scenario: A table
|
183
|
+
Then I should check the following table:
|
184
|
+
| letter | letter_plus_a |
|
185
|
+
| r | ra |
|
186
|
+
| m | ma |
|
187
|
+
| p | pa |
|
188
|
+
|
189
|
+
1 scenario (1 passed)
|
190
|
+
1 step (1 passed)
|
191
|
+
|
192
|
+
"""
|
193
|
+
|
194
|
+
Scenario: run a table scenario with an related registered transform using table
|
195
|
+
Given a file named "features/transform_sample.feature" with:
|
196
|
+
"""
|
197
|
+
Feature: Step argument transformations
|
198
|
+
|
199
|
+
Scenario: A table
|
200
|
+
Then I should check the following table:
|
201
|
+
| letter | letter_plus_a |
|
202
|
+
| r | ra |
|
203
|
+
| m | ma |
|
204
|
+
| p | pa |
|
205
|
+
"""
|
206
|
+
And a file named "features/support/table.rb" with:
|
207
|
+
"""
|
208
|
+
Transform /^table:letter,letter_plus_a$/ do |table|
|
209
|
+
table.rows.map { |row| row.join(',') }
|
210
|
+
end
|
211
|
+
|
212
|
+
Then "I should check the following table:" do |rows_in_table|
|
213
|
+
rows_in_table.should == ['r,ra','m,ma','p,pa']
|
214
|
+
end
|
215
|
+
"""
|
216
|
+
When I run cucumber -b -s features
|
217
|
+
Then it should pass with
|
218
|
+
"""
|
219
|
+
Feature: Step argument transformations
|
220
|
+
|
221
|
+
Scenario: A table
|
222
|
+
Then I should check the following table:
|
223
|
+
| letter | letter_plus_a |
|
224
|
+
| r | ra |
|
225
|
+
| m | ma |
|
226
|
+
| p | pa |
|
227
|
+
|
228
|
+
1 scenario (1 passed)
|
229
|
+
1 step (1 passed)
|
230
|
+
|
231
|
+
"""
|