cucumber 0.6.4 → 0.7.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/History.txt +11 -0
  2. data/Rakefile +3 -5
  3. data/VERSION.yml +3 -3
  4. data/cucumber.gemspec +35 -55
  5. data/cucumber.yml +3 -2
  6. data/examples/i18n/Rakefile +1 -0
  7. data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +1 -1
  8. data/examples/i18n/eo/.gitignore +1 -0
  9. data/examples/i18n/eo/Rakefile +6 -0
  10. data/examples/i18n/eo/features/adicio.feature +17 -0
  11. data/examples/i18n/eo/features/divido.feature +10 -0
  12. data/examples/i18n/eo/features/step_definitons/calculator_steps.rb +24 -0
  13. data/examples/i18n/eo/lib/calculator.rb +14 -0
  14. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
  15. data/examples/i18n/ru/features/division.feature +1 -1
  16. data/examples/i18n/uk/Rakefile +6 -0
  17. data/examples/i18n/uk/features/addition.feature +11 -0
  18. data/examples/i18n/uk/features/consecutive_calculations.feature +17 -0
  19. data/examples/i18n/uk/features/division.feature +16 -0
  20. data/examples/i18n/uk/features/step_definitons/calculator_steps.rb +19 -0
  21. data/examples/i18n/uk/features/support/env.rb +5 -0
  22. data/examples/i18n/uk/features/support/world.rb +8 -0
  23. data/examples/i18n/uk/lib/calculator.rb +24 -0
  24. data/examples/i18n/uz/features/step_definitons/calculator_steps.rb +1 -1
  25. data/examples/sinatra/features/add.feature +1 -1
  26. data/examples/sinatra/features/step_definitions/add_steps.rb +1 -1
  27. data/examples/sinatra/features/support/env.rb +2 -19
  28. data/examples/sinatra/views/add.erb +7 -5
  29. data/features/announce.feature +46 -39
  30. data/features/background.feature +3 -0
  31. data/features/call_many_steps.feature +1 -1
  32. data/features/cucumber_cli_outlines.feature +12 -0
  33. data/features/drb_server_integration.feature +1 -1
  34. data/features/exception_in_after_block.feature +3 -0
  35. data/features/exception_in_after_step_block.feature +3 -0
  36. data/features/html_formatter/a.html +29 -29
  37. data/features/language_help.feature +57 -52
  38. data/features/multiline_names.feature +1 -0
  39. data/features/step_definitions/cucumber_steps.rb +2 -1
  40. data/features/usage_and_stepdefs_formatter.feature +30 -30
  41. data/features/wire_protocol.feature +12 -9
  42. data/features/wire_protocol_table_diffing.feature +8 -6
  43. data/features/wire_protocol_timeouts.feature +5 -4
  44. data/gem_tasks/treetop.rake +13 -0
  45. data/lib/autotest/cucumber_mixin.rb +1 -1
  46. data/lib/cucumber/ast.rb +1 -0
  47. data/lib/cucumber/ast/background.rb +14 -4
  48. data/lib/cucumber/ast/examples.rb +2 -0
  49. data/lib/cucumber/ast/feature.rb +26 -5
  50. data/lib/cucumber/ast/feature_element.rb +18 -9
  51. data/lib/cucumber/ast/outline_table.rb +13 -1
  52. data/lib/cucumber/ast/py_string.rb +26 -9
  53. data/lib/cucumber/ast/scenario.rb +13 -7
  54. data/lib/cucumber/ast/scenario_outline.rb +18 -6
  55. data/lib/cucumber/ast/step.rb +4 -4
  56. data/lib/cucumber/ast/step_invocation.rb +5 -2
  57. data/lib/cucumber/ast/table.rb +26 -1
  58. data/lib/cucumber/ast/tags.rb +3 -1
  59. data/lib/cucumber/ast/tree_walker.rb +2 -18
  60. data/lib/cucumber/cli/configuration.rb +2 -2
  61. data/lib/cucumber/cli/options.rb +16 -21
  62. data/lib/cucumber/feature_file.rb +25 -7
  63. data/lib/cucumber/formatter/ansicolor.rb +6 -1
  64. data/lib/cucumber/formatter/console.rb +4 -3
  65. data/lib/cucumber/formatter/html.rb +8 -5
  66. data/lib/cucumber/formatter/junit.rb +5 -4
  67. data/lib/cucumber/formatter/pdf.rb +2 -3
  68. data/lib/cucumber/formatter/pretty.rb +5 -5
  69. data/lib/cucumber/formatter/usage.rb +2 -2
  70. data/lib/cucumber/parser.rb +0 -6
  71. data/lib/cucumber/parser/gherkin_builder.rb +142 -0
  72. data/lib/cucumber/platform.rb +0 -2
  73. data/lib/cucumber/rb_support/rb_language.rb +7 -12
  74. data/lib/cucumber/step_mother.rb +4 -26
  75. data/spec/cucumber/ast/background_spec.rb +0 -1
  76. data/spec/cucumber/ast/feature_factory.rb +2 -4
  77. data/spec/cucumber/ast/feature_spec.rb +0 -2
  78. data/spec/cucumber/ast/py_string_spec.rb +2 -13
  79. data/spec/cucumber/ast/scenario_outline_spec.rb +0 -1
  80. data/spec/cucumber/ast/scenario_spec.rb +0 -1
  81. data/spec/cucumber/ast/step_spec.rb +1 -1
  82. data/spec/cucumber/ast/table_spec.rb +2 -2
  83. data/spec/cucumber/cli/main_spec.rb +1 -1
  84. data/spec/cucumber/cli/options_spec.rb +2 -2
  85. data/spec/cucumber/formatter/html_spec.rb +20 -1
  86. data/spec/cucumber/formatter/junit_spec.rb +1 -0
  87. data/spec/cucumber/formatter/spec_helper.rb +7 -5
  88. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +0 -1
  89. data/spec/cucumber/step_mother_spec.rb +2 -2
  90. data/spec/spec_helper.rb +0 -1
  91. metadata +67 -93
  92. data/lib/cucumber/cli/language_help_formatter.rb +0 -72
  93. data/lib/cucumber/filter.rb +0 -43
  94. data/lib/cucumber/languages.yml +0 -536
  95. data/lib/cucumber/parser/common.rb +0 -182
  96. data/lib/cucumber/parser/common.tt +0 -21
  97. data/lib/cucumber/parser/feature.rb +0 -1591
  98. data/lib/cucumber/parser/feature.tt +0 -287
  99. data/lib/cucumber/parser/i18n.tt +0 -35
  100. data/lib/cucumber/parser/natural_language.rb +0 -118
  101. data/lib/cucumber/parser/py_string.rb +0 -285
  102. data/lib/cucumber/parser/py_string.tt +0 -45
  103. data/lib/cucumber/parser/table.rb +0 -314
  104. data/lib/cucumber/parser/table.tt +0 -60
  105. data/lib/cucumber/parser/treetop_ext.rb +0 -54
  106. data/lib/cucumber/tag_expression.rb +0 -41
  107. data/spec/cucumber/ast/feature_element_spec.rb +0 -41
  108. data/spec/cucumber/ast/step_collection_spec.rb +0 -17
  109. data/spec/cucumber/parser/feature_parser_spec.rb +0 -400
  110. data/spec/cucumber/parser/table_parser_spec.rb +0 -52
  111. data/spec/cucumber/tag_expression_spec.rb +0 -125
  112. data/spec/cucumber/treetop_parser/empty_feature.feature +0 -4
  113. data/spec/cucumber/treetop_parser/empty_scenario.feature +0 -9
  114. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +0 -3
  115. data/spec/cucumber/treetop_parser/fit_scenario.feature +0 -8
  116. data/spec/cucumber/treetop_parser/given_scenario.feature +0 -9
  117. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +0 -7
  118. data/spec/cucumber/treetop_parser/multiline_steps.feature +0 -17
  119. data/spec/cucumber/treetop_parser/multiple_tables.feature +0 -27
  120. data/spec/cucumber/treetop_parser/scenario_outline.feature +0 -16
  121. data/spec/cucumber/treetop_parser/spaces.feature +0 -12
  122. data/spec/cucumber/treetop_parser/test_dos.feature +0 -25
  123. data/spec/cucumber/treetop_parser/with_comments.feature +0 -23
  124. data/spec/cucumber/treetop_parser/with_tags.feature +0 -18
@@ -7,63 +7,68 @@ Feature: Language help
7
7
  When I run cucumber --i18n pt help
8
8
  Then it should pass with
9
9
  """
10
- | name | Portuguese |
11
- | native | português |
12
- | feature | Funcionalidade |
13
- | background | Contexto |
14
- | scenario | Cenário / Cenario |
15
- | scenario_outline | Esquema do Cenário / Esquema do Cenario |
16
- | examples | Exemplos |
17
- | given | * / Dado |
18
- | when | * / Quando |
19
- | then | * / Então / Entao |
20
- | and | * / E |
21
- | but | * / Mas |
10
+ | feature | "Funcionalidade" |
11
+ | background | "Contexto" |
12
+ | scenario | "Cenário", "Cenario" |
13
+ | scenario_outline | "Esquema do Cenário", "Esquema do Cenario" |
14
+ | examples | "Exemplos" |
15
+ | given | "* ", "Dado " |
16
+ | when | "* ", "Quando " |
17
+ | then | "* ", "Então ", "Entao " |
18
+ | and | "* ", "E " |
19
+ | but | "* ", "Mas " |
20
+ | given (code) | "Dado" |
21
+ | when (code) | "Quando" |
22
+ | then (code) | "Então", "Entao" |
22
23
 
23
24
  """
24
25
  Scenario: List languages
25
26
  When I run cucumber --i18n help
27
+ Then STDERR should be empty
26
28
  Then it should pass with
27
29
  """
28
- | ar | Arabic | العربية |
29
- | bg | Bulgarian | български |
30
- | ca | Catalan | català |
31
- | cs | Czech | Česky |
32
- | cy-GB | Welsh | Cymraeg |
33
- | da | Danish | dansk |
34
- | de | German | Deutsch |
35
- | en | English | English |
36
- | en-au | Australian | Australian |
37
- | en-lol | LOLCAT | LOLCAT |
38
- | en-tx | Texan | Texan |
39
- | es | Spanish | español |
40
- | et | Estonian | eesti keel |
41
- | fi | Finnish | suomi |
42
- | fr | French | français |
43
- | he | Hebrew | עברית |
44
- | hr | Croatian | hrvatski |
45
- | hu | Hungarian | magyar |
46
- | id | Indonesian | Bahasa Indonesia |
47
- | it | Italian | italiano |
48
- | ja | Japanese | 日本語 |
49
- | ko | Korean | 한국어 |
50
- | lt | Lithuanian | lietuvių kalba |
51
- | lv | Latvian | latviešu |
52
- | nl | Dutch | Nederlands |
53
- | no | Norwegian | norsk |
54
- | pl | Polish | polski |
55
- | pt | Portuguese | português |
56
- | ro | Romanian | română |
57
- | ro-RO | Romanian (diacritical) | română (diacritical) |
58
- | ru | Russian | русский |
59
- | sk | Slovak | Slovensky |
60
- | sr-Cyrl | Serbian | Српски |
61
- | sr-Latn | Serbian (Latin) | Srpski (Latinica) |
62
- | sv | Swedish | Svenska |
63
- | tr | Turkish | Türkçe |
64
- | uz | Uzbek | Узбекча |
65
- | vi | Vietnamese | Tiếng Việt |
66
- | zh-CN | Chinese simplified | 简体中文 |
67
- | zh-TW | Chinese traditional | 繁體中文 |
30
+ | ar | Arabic | العربية |
31
+ | bg | Bulgarian | български |
32
+ | ca | Catalan | català |
33
+ | cs | Czech | Česky |
34
+ | cy-GB | Welsh | Cymraeg |
35
+ | da | Danish | dansk |
36
+ | de | German | Deutsch |
37
+ | en | English | English |
38
+ | en-Scouse | Scouse | Scouse |
39
+ | en-au | Australian | Australian |
40
+ | en-lol | LOLCAT | LOLCAT |
41
+ | en-tx | Texan | Texan |
42
+ | eo | Esperanto | Esperanto |
43
+ | es | Spanish | español |
44
+ | et | Estonian | eesti keel |
45
+ | fi | Finnish | suomi |
46
+ | fr | French | français |
47
+ | he | Hebrew | עברית |
48
+ | hr | Croatian | hrvatski |
49
+ | hu | Hungarian | magyar |
50
+ | id | Indonesian | Bahasa Indonesia |
51
+ | it | Italian | italiano |
52
+ | ja | Japanese | 日本語 |
53
+ | ko | Korean | 한국어 |
54
+ | lt | Lithuanian | lietuvių kalba |
55
+ | lv | Latvian | latviešu |
56
+ | nl | Dutch | Nederlands |
57
+ | no | Norwegian | norsk |
58
+ | pl | Polish | polski |
59
+ | pt | Portuguese | português |
60
+ | ro | Romanian | română |
61
+ | ro-RO | Romanian (diacritical) | română (diacritical) |
62
+ | ru | Russian | русский |
63
+ | sk | Slovak | Slovensky |
64
+ | sr-Cyrl | Serbian | Српски |
65
+ | sr-Latn | Serbian (Latin) | Srpski (Latinica) |
66
+ | sv | Swedish | Svenska |
67
+ | tr | Turkish | Türkçe |
68
+ | uk | Ukrainian | Українська |
69
+ | uz | Uzbek | Узбекча |
70
+ | vi | Vietnamese | Tiếng Việt |
71
+ | zh-CN | Chinese simplified | 简体中文 |
72
+ | zh-TW | Chinese traditional | 繁體中文 |
68
73
 
69
74
  """
@@ -5,6 +5,7 @@ Feature: Multiline description names
5
5
 
6
6
  Scenario: multiline scenario
7
7
  When I run cucumber features/multiline_name.feature --no-snippets
8
+ Then STDERR should be empty
8
9
  Then it should pass with
9
10
  """
10
11
  Feature: multiline
@@ -8,6 +8,7 @@ end
8
8
  Given /^a standard Cucumber project directory structure$/ do
9
9
  @current_dir = working_dir
10
10
  in_current_dir do
11
+ FileUtils.rm_rf 'features' if File.directory?('features')
11
12
  FileUtils.mkdir_p 'features/support'
12
13
  FileUtils.mkdir 'features/step_definitions'
13
14
  end
@@ -49,7 +50,7 @@ Given /^I have environment variable (\w+) set to "([^\"]*)"$/ do |variable, valu
49
50
  end
50
51
 
51
52
  When /^I run cucumber (.*)$/ do |cucumber_opts|
52
- run "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} --no-color #{cucumber_opts} CUCUMBER_OUTPUT_ENCODING=UTF-8"
53
+ run "#{Cucumber::RUBY_BINARY} -r rubygems #{Cucumber::BINARY} --no-color #{cucumber_opts} CUCUMBER_OUTPUT_ENCODING=UTF-8"
53
54
  end
54
55
 
55
56
  When /^I run rake (.*)$/ do |rake_opts|
@@ -136,34 +136,34 @@ Feature: Cucumber command line
136
136
 
137
137
  """
138
138
 
139
- Scenario: --format steps
140
- When I run cucumber features --format stepdefs --dry-run
141
- Then STDERR should be empty
142
- And it should pass with
143
- """
144
- -------------------------------------UU-U--------------UUUUU---------U-------U--------------U-UU-------------------------------------------------UU
145
-
146
- /^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
147
- /^'(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:35
148
- /^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
149
- /^I should have '(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:42
150
- /^a step definition that calls an undefined step$/ # features/step_definitions/sample_steps.rb:19
151
- /^another unused$/ # features/step_definitions/sample_steps.rb:69
152
- NOT MATCHED BY ANY STEPS
153
- /^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
154
- /^failing expectation$/ # features/step_definitions/sample_steps.rb:62
155
- /^failing without a table$/ # features/step_definitions/sample_steps.rb:15
156
- /^failing$/ # features/step_definitions/sample_steps.rb:8
157
- /^multiline string$/ # features/step_definitions/sample_steps.rb:50
158
- /^passing without a table$/ # features/step_definitions/sample_steps.rb:12
159
- /^passing$/ # features/step_definitions/sample_steps.rb:5
160
- /^table$/ # features/step_definitions/sample_steps.rb:46
161
- /^the multiline string should be$/ # features/step_definitions/sample_steps.rb:58
162
- /^the table should be$/ # features/step_definitions/sample_steps.rb:54
163
- /^unused$/ # features/step_definitions/sample_steps.rb:66
164
- NOT MATCHED BY ANY STEPS
165
-
166
- 43 scenarios (32 skipped, 10 undefined, 1 passed)
167
- 131 steps (117 skipped, 14 undefined)
139
+ Scenario: --format stepdefs
140
+ When I run cucumber features --format stepdefs --dry-run
141
+ Then STDERR should be empty
142
+ And it should pass with
143
+ """
144
+ -------------------------------------UU-U--------------UUUUU---------U-------U--------------U-UU-------------------------------------------------UU
145
+
146
+ /^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
147
+ /^'(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:35
148
+ /^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
149
+ /^I should have '(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:42
150
+ /^a step definition that calls an undefined step$/ # features/step_definitions/sample_steps.rb:19
151
+ /^another unused$/ # features/step_definitions/sample_steps.rb:69
152
+ NOT MATCHED BY ANY STEPS
153
+ /^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
154
+ /^failing expectation$/ # features/step_definitions/sample_steps.rb:62
155
+ /^failing without a table$/ # features/step_definitions/sample_steps.rb:15
156
+ /^failing$/ # features/step_definitions/sample_steps.rb:8
157
+ /^multiline string$/ # features/step_definitions/sample_steps.rb:50
158
+ /^passing without a table$/ # features/step_definitions/sample_steps.rb:12
159
+ /^passing$/ # features/step_definitions/sample_steps.rb:5
160
+ /^table$/ # features/step_definitions/sample_steps.rb:46
161
+ /^the multiline string should be$/ # features/step_definitions/sample_steps.rb:58
162
+ /^the table should be$/ # features/step_definitions/sample_steps.rb:54
163
+ /^unused$/ # features/step_definitions/sample_steps.rb:66
164
+ NOT MATCHED BY ANY STEPS
165
+
166
+ 43 scenarios (32 skipped, 10 undefined, 1 passed)
167
+ 131 steps (117 skipped, 14 undefined)
168
168
 
169
- """
169
+ """
@@ -41,6 +41,7 @@ Feature: Wire Protocol
41
41
  Given a standard Cucumber project directory structure
42
42
  And a file named "features/wired.feature" with:
43
43
  """
44
+ Feature: High strung
44
45
  Scenario: Wired
45
46
  Given we're all wired
46
47
 
@@ -108,7 +109,7 @@ Feature: Wire Protocol
108
109
  """
109
110
  -
110
111
 
111
- we.* # MyApp.MyClass:123
112
+ we.* # MyApp.MyClass:123
112
113
 
113
114
  1 scenario (1 skipped)
114
115
  1 step (1 skipped)
@@ -147,12 +148,12 @@ Feature: Wire Protocol
147
148
  When I run cucumber -f pretty -q
148
149
  And it should pass with
149
150
  """
150
-
151
+ Feature: High strung
151
152
 
152
153
  Scenario: Wired
153
154
  Given we're all wired
154
155
  I'll do it later (Cucumber::Pending)
155
- features/wired.feature:2:in `Given we're all wired'
156
+ features/wired.feature:3:in `Given we're all wired'
156
157
 
157
158
  1 scenario (1 pending)
158
159
  1 step (1 pending)
@@ -207,10 +208,10 @@ Feature: Wire Protocol
207
208
  (::) failed steps (::)
208
209
 
209
210
  The wires are down (Some.Foreign.ExceptionType from localhost:54321)
210
- features/wired.feature:2:in `Given we're all wired'
211
+ features/wired.feature:3:in `Given we're all wired'
211
212
 
212
213
  Failing Scenarios:
213
- cucumber features/wired.feature:1 # Scenario: Wired
214
+ cucumber features/wired.feature:2 # Scenario: Wired
214
215
 
215
216
  1 scenario (1 failed)
216
217
  1 step (1 failed)
@@ -261,6 +262,7 @@ Feature: Wire Protocol
261
262
  Scenario: Invoke a step definition which takes table arguments (and passes)
262
263
  Given a file named "features/wired_on_tables.feature" with:
263
264
  """
265
+ Feature: High strung
264
266
  Scenario: Wired and more
265
267
  Given we're all:
266
268
  | wired |
@@ -292,16 +294,17 @@ Feature: Wire Protocol
292
294
  Given there is a wire server running on port 54321 which understands the following protocol:
293
295
  | request | response |
294
296
  | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
295
- | ["snippet_text",{"step_keyword":"Given","multiline_arg_class":"","step_name":"we're all wired"}] | ["success","foo()\n bar;\nbaz"] |
297
+ | ["snippet_text",{"step_keyword":"Given ","multiline_arg_class":"","step_name":"we're all wired"}] | ["success","foo()\n bar;\nbaz"] |
296
298
  | ["begin_scenario"] | ["success"] |
297
299
  | ["end_scenario"] | ["success"] |
298
300
  When I run cucumber -f pretty
301
+ Then STDERR should be empty
299
302
  And it should pass with
300
303
  """
304
+ Feature: High strung
301
305
 
302
-
303
- Scenario: Wired # features/wired.feature:1
304
- Given we're all wired # features/wired.feature:2
306
+ Scenario: Wired # features/wired.feature:2
307
+ Given we're all wired # features/wired.feature:3
305
308
 
306
309
  1 scenario (1 undefined)
307
310
  1 step (1 undefined)
@@ -8,6 +8,7 @@ Feature: Wire protocol table diffing
8
8
  Given a standard Cucumber project directory structure
9
9
  And a file named "features/wired.feature" with:
10
10
  """
11
+ Feature: Hello
11
12
  Scenario: Wired
12
13
  Given we're all wired
13
14
 
@@ -28,6 +29,7 @@ Feature: Wire protocol table diffing
28
29
  | ["diff_failed"] | ["fail",{"message":"Not same", "exception":"DifferentException", "backtrace":["a.cs:12","b.cs:34"]}] |
29
30
  | ["end_scenario"] | ["success"] |
30
31
  When I run cucumber -f progress --backtrace
32
+ Then STDERR should be empty
31
33
  And it should fail with
32
34
  """
33
35
  F
@@ -37,10 +39,10 @@ Feature: Wire protocol table diffing
37
39
  Not same (DifferentException from localhost:54321)
38
40
  a.cs:12
39
41
  b.cs:34
40
- features/wired.feature:2:in `Given we're all wired'
42
+ features/wired.feature:3:in `Given we're all wired'
41
43
 
42
44
  Failing Scenarios:
43
- cucumber features/wired.feature:1 # Scenario: Wired
45
+ cucumber features/wired.feature:2 # Scenario: Wired
44
46
 
45
47
  1 scenario (1 failed)
46
48
  1 step (1 failed)
@@ -81,10 +83,10 @@ Feature: Wire protocol table diffing
81
83
  (::) failed steps (::)
82
84
 
83
85
  I wanted things to be different for us (Cucumber::WireSupport::WireException)
84
- features/wired.feature:2:in `Given we're all wired'
86
+ features/wired.feature:3:in `Given we're all wired'
85
87
 
86
88
  Failing Scenarios:
87
- cucumber features/wired.feature:1 # Scenario: Wired
89
+ cucumber features/wired.feature:2 # Scenario: Wired
88
90
 
89
91
  1 scenario (1 failed)
90
92
  1 step (1 failed)
@@ -106,10 +108,10 @@ Feature: Wire protocol table diffing
106
108
  (::) failed steps (::)
107
109
 
108
110
  Tables were not identical (Cucumber::Ast::Table::Different)
109
- features/wired.feature:2:in `Given we're all wired'
111
+ features/wired.feature:3:in `Given we're all wired'
110
112
 
111
113
  Failing Scenarios:
112
- cucumber features/wired.feature:1 # Scenario: Wired
114
+ cucumber features/wired.feature:2 # Scenario: Wired
113
115
 
114
116
  1 scenario (1 failed)
115
117
  1 step (1 failed)
@@ -8,6 +8,7 @@ Feature: Wire protocol timeouts
8
8
  Given a standard Cucumber project directory structure
9
9
  And a file named "features/wired.feature" with:
10
10
  """
11
+ Feature: Telegraphy
11
12
  Scenario: Wired
12
13
  Given we're all wired
13
14
 
@@ -46,15 +47,15 @@ Feature: Wire protocol timeouts
46
47
  Then STDERR should be empty
47
48
  And it should fail with
48
49
  """
50
+ Feature: Telegraphy
49
51
 
50
-
51
- Scenario: Wired # features/wired.feature:1
52
+ Scenario: Wired # features/wired.feature:2
52
53
  Given we're all wired # Unknown
53
54
  Timed out calling wire server with message 'invoke' (Timeout::Error)
54
- features/wired.feature:2:in `Given we're all wired'
55
+ features/wired.feature:3:in `Given we're all wired'
55
56
 
56
57
  Failing Scenarios:
57
- cucumber features/wired.feature:1 # Scenario: Wired
58
+ cucumber features/wired.feature:2 # Scenario: Wired
58
59
 
59
60
  1 scenario (1 failed)
60
61
  1 step (1 failed)
@@ -0,0 +1,13 @@
1
+ namespace :tt do
2
+ files = %w{lib/cucumber/parser/common.tt lib/cucumber/parser/feature.tt lib/cucumber/parser/py_string.tt lib/cucumber/parser/table.tt}
3
+
4
+ desc 'Compile .tt files'
5
+ task :compile do
6
+ files.each {|tt| sh("tt #{tt}") }
7
+ end
8
+
9
+ desc 'Remove compiled .tt files'
10
+ task :rm do
11
+ rm_rf files.map{|tt| tt.gsub(/\.tt$/, '.rb')}
12
+ end
13
+ end
@@ -117,7 +117,7 @@ module Autotest::CucumberMixin
117
117
  end
118
118
  # No --color option as some IDEs (Netbeans) don't output them very well (1 failed step)
119
119
  args += %w{--format rerun --out} << dirty_features_filename
120
- args << (features_to_run == :all ? "features" : features_to_run)
120
+ args << (features_to_run == :all ? "" : features_to_run)
121
121
 
122
122
  # Unless I do this, all the steps turn up undefined during the rerun...
123
123
  unless features_to_run == :all
@@ -8,6 +8,7 @@ require 'cucumber/ast/step_invocation'
8
8
  require 'cucumber/ast/step_collection'
9
9
  require 'cucumber/ast/step'
10
10
  require 'cucumber/ast/table'
11
+ require 'cucumber/ast/tags'
11
12
  require 'cucumber/ast/py_string'
12
13
  require 'cucumber/ast/outline_table'
13
14
  require 'cucumber/ast/examples'
@@ -6,14 +6,20 @@ module Cucumber
6
6
  include FeatureElement
7
7
  attr_reader :feature_elements
8
8
 
9
- def initialize(comment, line, keyword, name, steps)
10
- @comment, @line, @keyword, @name, @steps = comment, line, keyword, name, StepCollection.new(steps)
11
- attach_steps(steps)
12
- @step_invocations = @steps.step_invocations(true)
9
+ def initialize(comment, line, keyword, name, raw_steps)
10
+ @comment, @line, @keyword, @name, @raw_steps = comment, line, keyword, name, raw_steps
13
11
  @feature_elements = []
14
12
  end
15
13
 
14
+ def init
15
+ return if @steps
16
+ attach_steps(@raw_steps)
17
+ @steps = StepCollection.new(@raw_steps)
18
+ @step_invocations = @steps.step_invocations(true)
19
+ end
20
+
16
21
  def step_collection(step_invocations)
22
+ init
17
23
  unless(@first_collection_created)
18
24
  @first_collection_created = true
19
25
  @step_invocations.dup(step_invocations)
@@ -24,6 +30,7 @@ module Cucumber
24
30
 
25
31
  def accept(visitor)
26
32
  return if Cucumber.wants_to_quit
33
+ init
27
34
  visitor.visit_comment(@comment) unless @comment.empty?
28
35
  visitor.visit_background_name(@keyword, @name, file_colon_line(@line), source_indent(first_line_length))
29
36
  with_visitor(hook_context, visitor) do
@@ -35,6 +42,7 @@ module Cucumber
35
42
  end
36
43
 
37
44
  def with_visitor(scenario, visitor)
45
+ init
38
46
  if self != scenario && scenario.respond_to?(:with_visitor)
39
47
  scenario.with_visitor(visitor) do
40
48
  yield
@@ -45,6 +53,7 @@ module Cucumber
45
53
  end
46
54
 
47
55
  def accept_hook?(hook)
56
+ init
48
57
  if hook_context != self
49
58
  hook_context.accept_hook?(hook)
50
59
  else
@@ -62,6 +71,7 @@ module Cucumber
62
71
  end
63
72
 
64
73
  def to_sexp
74
+ init
65
75
  sexp = [:background, @line, @keyword]
66
76
  sexp += [@name] unless @name.empty?
67
77
  comment = @comment.to_sexp