cucumber 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. data/History.txt +86 -3
  2. data/Manifest.txt +93 -44
  3. data/Rakefile +5 -1
  4. data/bin/cucumber +1 -0
  5. data/cucumber.yml +1 -1
  6. data/examples/calculator_ruby_features/features/{steps → step_definitons}/calculator_steps.rb +0 -0
  7. data/examples/cs/features/{steps → step_definitons}/hello_steps.rb +0 -0
  8. data/examples/cs/features/{steps → step_definitons}/tree_steps.rb +0 -0
  9. data/examples/i18n/README.textile +18 -0
  10. data/examples/i18n/Rakefile +16 -0
  11. data/examples/i18n/ar/Rakefile +6 -0
  12. data/examples/i18n/ar/features/addition.feature +17 -0
  13. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +31 -0
  14. data/examples/i18n/ar/lib/calculator.rb +10 -0
  15. data/examples/i18n/da/Rakefile +6 -0
  16. data/examples/{danish_calculator/features/steps → i18n/da/features/step_definitons}/kalkulator_steps.rb +0 -0
  17. data/examples/{danish_calculator → i18n/da}/features/summering.feature +1 -1
  18. data/examples/{danish_calculator → i18n/da}/lib/kalkulator.rb +0 -0
  19. data/examples/{swedish_calculator → i18n/en}/Rakefile +1 -1
  20. data/examples/{calculator → i18n/en}/features/addition.feature +0 -0
  21. data/examples/{calculator → i18n/en}/features/division.feature +0 -0
  22. data/examples/{calculator/features/steps → i18n/en/features/step_definitons}/calculator_steps.rb +0 -0
  23. data/examples/{calculator → i18n/en}/lib/calculator.rb +0 -2
  24. data/examples/i18n/es/Rakefile +6 -0
  25. data/examples/{spanish_calculator → i18n/es}/features/adicion.feature +1 -1
  26. data/examples/{spanish_calculator/features/steps → i18n/es/features/step_definitons}/calculador_steps.rb +0 -0
  27. data/examples/{spanish_calculator/lib/Calculador.rb → i18n/es/lib/calculador.rb} +0 -0
  28. data/examples/i18n/et/Rakefile +6 -0
  29. data/examples/i18n/et/features/liitmine.feature +17 -0
  30. data/examples/{estonian_calculator/features → i18n/et/features/step_definitions}/kalkulaator_steps.rb +2 -11
  31. data/examples/i18n/et/lib/kalkulaator.rb +10 -0
  32. data/examples/i18n/fr/Rakefile +6 -0
  33. data/examples/{calculatrice_francaise_avec_soit_scenario → i18n/fr}/features/addition.feature +0 -0
  34. data/examples/{calculatrice_francaise_avec_soit_scenario/features → i18n/fr/features/step_definitions}/calculatrice_steps.rb +2 -11
  35. data/examples/i18n/fr/lib/calculatrice.rb +10 -0
  36. data/examples/i18n/id/Rakefile +6 -0
  37. data/examples/i18n/id/features/addition.feature +17 -0
  38. data/examples/i18n/id/features/division.feature +10 -0
  39. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +31 -0
  40. data/examples/i18n/id/lib/calculator.rb +14 -0
  41. data/examples/i18n/it/Rakefile +6 -0
  42. data/examples/i18n/it/features/somma.feature +10 -0
  43. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +22 -0
  44. data/examples/i18n/it/lib/calcolatrice.rb +11 -0
  45. data/examples/{calculator → i18n/ja}/README.txt +0 -0
  46. data/examples/i18n/ja/Rakefile +6 -0
  47. data/examples/i18n/ja/features/addition.feature +17 -0
  48. data/examples/i18n/ja/features/division.feature +10 -0
  49. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +30 -0
  50. data/examples/i18n/ja/lib/calculator.rb +14 -0
  51. data/examples/i18n/no/Rakefile +6 -0
  52. data/examples/{norwegian_calculator/features/steps → i18n/no/features/step_definitons}/kalkulator_steps.rb +0 -0
  53. data/examples/{norwegian_calculator → i18n/no}/features/summering.feature +0 -0
  54. data/examples/{norwegian_calculator → i18n/no}/lib/kalkulator.rb +0 -0
  55. data/examples/i18n/pt/Rakefile +6 -0
  56. data/examples/{portuguese_calculator → i18n/pt}/features/adicao.feature +0 -0
  57. data/examples/{portuguese_calculator/features → i18n/pt/features/step_definitions}/calculadora_steps.rb +2 -11
  58. data/examples/i18n/pt/lib/calculadora.rb +10 -0
  59. data/examples/i18n/ro/Rakefile +6 -0
  60. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +22 -0
  61. data/examples/i18n/ro/features/suma.feature +10 -0
  62. data/examples/i18n/ro/lib/calculator.rb +11 -0
  63. data/examples/i18n/se/Rakefile +6 -0
  64. data/examples/{swedish_calculator/features/steps → i18n/se/features/step_definitons}/kalkulator_steps.rb +0 -0
  65. data/examples/{swedish_calculator → i18n/se}/features/summering.feature +0 -0
  66. data/examples/{swedish_calculator → i18n/se}/lib/kalkulator.rb +0 -0
  67. data/examples/i18n/zh-CN/Rakefile +6 -0
  68. data/examples/{chinese_simplified_calculator → i18n/zh-CN}/features/addition.feature +0 -0
  69. data/examples/{chinese_simplified_calculator/features/steps → i18n/zh-CN/features/step_definitons}/calculator_steps.rb +0 -0
  70. data/examples/{chinese_simplified_calculator → i18n/zh-CN}/lib/calculator.rb +0 -0
  71. data/examples/java/features/{steps → step_definitons}/hello_steps.rb +0 -0
  72. data/examples/java/features/{steps → step_definitons}/tree_steps.rb +0 -0
  73. data/examples/selenium/features/{steps → step_definitons}/stories_steps.rb +0 -0
  74. data/examples/tickets/features/{steps → step_definitons}/tickets_steps.rb +0 -0
  75. data/examples/watir/features/search.feature +2 -2
  76. data/examples/watir/features/{steps → step_definitons}/stories_steps.rb +0 -0
  77. data/gem_tasks/treetop.rake +1 -9
  78. data/lib/autotest/cucumber.rb +6 -0
  79. data/lib/autotest/cucumber_mixin.rb +109 -0
  80. data/lib/autotest/cucumber_rails.rb +6 -0
  81. data/lib/autotest/cucumber_rails_rspec.rb +6 -0
  82. data/lib/autotest/cucumber_rspec.rb +6 -0
  83. data/lib/autotest/discover.rb +9 -0
  84. data/lib/cucumber.rb +4 -0
  85. data/lib/cucumber/broadcaster.rb +20 -0
  86. data/lib/cucumber/cli.rb +139 -48
  87. data/lib/cucumber/core_ext/proc.rb +2 -3
  88. data/lib/cucumber/executor.rb +59 -32
  89. data/lib/cucumber/formatters.rb +1 -1
  90. data/lib/cucumber/formatters/ansicolor.rb +3 -4
  91. data/lib/cucumber/formatters/autotest_formatter.rb +23 -0
  92. data/lib/cucumber/formatters/pretty_formatter.rb +99 -42
  93. data/lib/cucumber/formatters/progress_formatter.rb +21 -5
  94. data/lib/cucumber/languages.yml +125 -10
  95. data/lib/cucumber/rails/world.rb +1 -1
  96. data/lib/cucumber/rake/task.rb +52 -26
  97. data/lib/cucumber/step_mother.rb +7 -1
  98. data/lib/cucumber/tree/feature.rb +8 -6
  99. data/lib/cucumber/tree/scenario.rb +34 -15
  100. data/lib/cucumber/tree/step.rb +3 -1
  101. data/lib/cucumber/treetop_parser/feature.treetop.erb +15 -10
  102. data/lib/cucumber/treetop_parser/feature_ar.rb +1591 -0
  103. data/lib/cucumber/treetop_parser/feature_cy.rb +1591 -0
  104. data/lib/cucumber/treetop_parser/feature_da.rb +238 -240
  105. data/lib/cucumber/treetop_parser/feature_de.rb +238 -240
  106. data/lib/cucumber/treetop_parser/feature_en-tx.rb +1591 -0
  107. data/lib/cucumber/treetop_parser/feature_en.rb +238 -240
  108. data/lib/cucumber/treetop_parser/feature_es.rb +238 -240
  109. data/lib/cucumber/treetop_parser/feature_et.rb +238 -240
  110. data/lib/cucumber/treetop_parser/feature_fr.rb +238 -240
  111. data/lib/cucumber/treetop_parser/feature_id.rb +1591 -0
  112. data/lib/cucumber/treetop_parser/feature_it.rb +1591 -0
  113. data/lib/cucumber/treetop_parser/feature_ja.rb +1591 -0
  114. data/lib/cucumber/treetop_parser/feature_nl.rb +238 -240
  115. data/lib/cucumber/treetop_parser/feature_no.rb +238 -240
  116. data/lib/cucumber/treetop_parser/feature_pl.rb +1591 -0
  117. data/lib/cucumber/treetop_parser/feature_pt.rb +238 -240
  118. data/lib/cucumber/treetop_parser/feature_ro.rb +1591 -0
  119. data/lib/cucumber/treetop_parser/feature_ro2.rb +1591 -0
  120. data/lib/cucumber/treetop_parser/feature_ru.rb +238 -240
  121. data/lib/cucumber/treetop_parser/feature_se.rb +238 -240
  122. data/lib/cucumber/treetop_parser/feature_zh-CN.rb +238 -240
  123. data/lib/cucumber/version.rb +1 -1
  124. data/rails_generators/cucumber/USAGE +11 -0
  125. data/rails_generators/cucumber/cucumber_generator.rb +9 -6
  126. data/rails_generators/cucumber/templates/cucumber +6 -1
  127. data/rails_generators/cucumber/templates/{common_webrat.rb → webrat_steps.rb} +4 -0
  128. data/rails_generators/feature/USAGE +12 -0
  129. data/rails_generators/feature/feature_generator.rb +3 -4
  130. data/spec/cucumber/broadcaster_spec.rb +27 -0
  131. data/spec/cucumber/cli_spec.rb +211 -23
  132. data/spec/cucumber/executor_spec.rb +104 -14
  133. data/spec/cucumber/formatters/ansicolor_spec.rb +9 -1
  134. data/spec/cucumber/formatters/autotest_formatter_spec.rb +26 -0
  135. data/spec/cucumber/formatters/pretty_formatter_spec.rb +119 -26
  136. data/spec/cucumber/formatters/profile_formatter_spec.rb +1 -2
  137. data/spec/cucumber/formatters/progress_formatter_spec.rb +22 -1
  138. data/spec/cucumber/sell_cucumbers.feature +10 -0
  139. data/spec/cucumber/step_mother_spec.rb +21 -0
  140. data/spec/cucumber/tree/row_scenario_spec.rb +25 -0
  141. data/spec/cucumber/tree/scenario_spec.rb +47 -8
  142. data/spec/cucumber/tree/step_spec.rb +19 -0
  143. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +2 -0
  144. data/spec/cucumber/treetop_parser/multiline_steps.feature +7 -3
  145. data/spec/spec_helper.rb +2 -0
  146. metadata +97 -48
  147. data/examples/calculator/Rakefile +0 -5
  148. data/examples/calculatrice_francaise_avec_soit_scenario/Rakefile +0 -6
  149. data/examples/chinese_simplified_calculator/Rakefile +0 -6
  150. data/examples/danish_calculator/Rakefile +0 -6
  151. data/examples/estonian_calculator/Rakefile +0 -6
  152. data/examples/estonian_calculator/features/liitmine.feature +0 -16
  153. data/examples/norwegian_calculator/Rakefile +0 -6
  154. data/examples/portuguese_calculator/Rakefile +0 -6
  155. data/examples/spanish_calculator/Rakefile +0 -6
@@ -7,28 +7,44 @@ module Cucumber
7
7
 
8
8
  def initialize(io)
9
9
  @io = (io == STDOUT) ? Kernel : io
10
- @errors = []
10
+ @errors = []
11
+ @pending_scenarios = []
11
12
  end
12
-
13
+
14
+ def scenario_executing(scenario)
15
+ if scenario.pending?
16
+ @pending_scenarios << scenario
17
+ @io.print pending("P")
18
+ end
19
+ end
20
+
13
21
  def step_passed(step, regexp, args)
14
22
  @io.print passed('.')
15
23
  end
16
-
24
+
17
25
  def step_failed(step, regexp, args)
18
26
  @errors << step.error
19
27
  @io.print failed('F')
20
28
  end
21
-
29
+
22
30
  def step_pending(step, regexp, args)
31
+ @pending_scenarios << step.scenario
23
32
  @io.print pending('P')
24
33
  end
25
-
34
+
26
35
  def step_skipped(step, regexp, args)
27
36
  @io.print skipped('_')
28
37
  end
29
38
 
30
39
  def dump
40
+ @io.puts pending
41
+ @io.puts "\nPending Scenarios:\n\n" if @pending_scenarios.any?
42
+ @pending_scenarios.uniq.each_with_index do |scenario, n|
43
+ @io.puts "#{n+1}) #{scenario.feature.header.split("\n").first.gsub(/^(Feature|Story):/, '')} (#{scenario.name})"
44
+ end
45
+
31
46
  @io.puts failed
47
+ @io.puts "\nFailed:" if @errors.any?
32
48
  @errors.each_with_index do |error,n|
33
49
  @io.puts
34
50
  @io.puts "#{n+1})"
@@ -1,3 +1,6 @@
1
+ # http://www.ietf.org/rfc/rfc4646.txt
2
+ # http://www.ietf.org/rfc/rfc4647.txt
3
+ # Others:
1
4
  # http://en.wikipedia.org/wiki/IETF_language_tag
2
5
  # http://www.iana.org/assignments/language-subtag-registry
3
6
  # http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt (Use this I think)
@@ -11,11 +14,35 @@
11
14
  then: Then
12
15
  and: And
13
16
  but: But
14
- # Please help us keeping the languages below uptodate. The parsers for a language
17
+ # Please help us keeping the languages below uptodate. The parsers for a language
15
18
  # that is missing a keyword will expect the English word until the missing word(s)
16
19
  # are added.
17
20
  #
18
21
  # Please keep the grammars in alphabetical order from here and down.
22
+
23
+ # Arabic
24
+ "ar":
25
+ feature: خاصية
26
+ scenario: سيناريو
27
+ more_examples: امثلة اكثر
28
+ given_scenario: بفرض سيناريو معين
29
+ given: بفرض
30
+ when: متى
31
+ then: اذاً
32
+ and: و
33
+ but: لكن
34
+ # Welsh
35
+ "cy":
36
+ feature: Arwedd
37
+ scenario: Scenario
38
+ more_examples: Hychwaneg enghreifftiau
39
+ given_scenario: Anrhegedig scenario
40
+ given: anrhegedig a
41
+ when: Pryd
42
+ then: Yna
43
+ and: A
44
+ but: Ond
45
+ # Danish
19
46
  "da":
20
47
  feature: Egenskab
21
48
  scenario: Scenarie
@@ -25,6 +52,7 @@
25
52
  then: Så
26
53
  and: Og
27
54
  but: Men
55
+ # German
28
56
  "de":
29
57
  feature: Funktionalität
30
58
  scenario: Szenario
@@ -34,6 +62,18 @@
34
62
  then: Dann
35
63
  and: Und
36
64
  but: Aber
65
+ # Texan
66
+ "en-tx":
67
+ feature: Feature
68
+ scenario: Scenario
69
+ more_examples: More Examples
70
+ given_scenario: GivenScenario
71
+ given: Given y'all
72
+ when: When y'all
73
+ then: Then y'all
74
+ and: And y'all
75
+ but: But y'all
76
+ # Spanish
37
77
  "es":
38
78
  feature: Característica
39
79
  scenario: Escenario
@@ -44,6 +84,17 @@
44
84
  then: Entonces
45
85
  and: Y
46
86
  but: Pero
87
+ # Estonian
88
+ "et":
89
+ feature: Omadus
90
+ scenario: Stsenaarium
91
+ given_scenario: EeldadesStsenaariumit
92
+ given: Eeldades
93
+ when: Kui
94
+ then: Siis
95
+ and: Ja
96
+ but: Kuid
97
+ # French
47
98
  "fr":
48
99
  feature: Fonction
49
100
  scenario: Scenario
@@ -54,6 +105,40 @@
54
105
  then: Alors
55
106
  and: Et
56
107
  but: Mais
108
+ # Malay
109
+ "id":
110
+ feature: Fitur
111
+ scenario: Skenario
112
+ more_examples: Contoh Tambahan
113
+ given_scenario: DenganSkenario
114
+ given: Dengan
115
+ when: Ketika
116
+ then: Maka
117
+ and: Dan
118
+ but: Tapi
119
+ # Italian
120
+ "it":
121
+ feature: Funzionalità
122
+ scenario: Scenario
123
+ more_examples: Più esempi
124
+ given_scenario: DatoLoScenario
125
+ given: Dato
126
+ when: Quando
127
+ then: Allora
128
+ and: E
129
+ but: Ma
130
+ # Japanese
131
+ "ja":
132
+ feature: フィーチャ
133
+ scenario: シナリオ
134
+ more_examples: 他のサンプル
135
+ given_scenario: 前提シナリオ
136
+ given: 前提
137
+ when: もし
138
+ then: ならば
139
+ and: かつ
140
+ but: しかし
141
+ # Dutch
57
142
  "nl":
58
143
  feature: Functionaliteit
59
144
  scenario: Scenario
@@ -64,6 +149,7 @@
64
149
  then: Dan
65
150
  and: En
66
151
  but: Maar
152
+ # Norwegian
67
153
  "no":
68
154
  feature: Egenskap
69
155
  scenario: Scenario
@@ -74,6 +160,18 @@
74
160
  then: Så
75
161
  and: Og
76
162
  but: Men
163
+ # Polish
164
+ "pl":
165
+ feature: Właściwość
166
+ scenario: Scenariusz
167
+ more_examples: WięcejPrzykładów
168
+ given_scenario: DanyScenariusz
169
+ given: Dane
170
+ when: Jeżeli
171
+ then: Wtedy
172
+ and: Oraz
173
+ but: Ale
174
+ # Portuguese
77
175
  "pt":
78
176
  feature: Característica
79
177
  scenario: Cenário
@@ -83,6 +181,29 @@
83
181
  then: Então
84
182
  and: E
85
183
  but: Mas
184
+ # Romanian (without diacritics - the commonly used)
185
+ "ro":
186
+ feature: Functionalitate
187
+ scenario: Scenariu
188
+ more_examples: Mai multe exemple
189
+ given_scenario: ScenariuDat
190
+ given: Daca
191
+ when: Cand
192
+ then: Atunci
193
+ and: Si
194
+ but: Dar
195
+ # Romanian (with diacritics - not commonly used)
196
+ "ro2":
197
+ feature: Funcționalitate
198
+ scenario: Scenariu
199
+ more_examples: Mai multe exemple
200
+ given_scenario: ScenariuDat
201
+ given: Dacă
202
+ when: Când
203
+ then: Atunci
204
+ and: Și
205
+ but: Dar
206
+ # Russian
86
207
  "ru":
87
208
  feature: Функционал
88
209
  scenario: Сценарий
@@ -92,6 +213,7 @@
92
213
  then: То
93
214
  and: И
94
215
  but: Но
216
+ # Swedish
95
217
  "se":
96
218
  feature: Egenskap
97
219
  scenario: Scenario
@@ -101,16 +223,9 @@
101
223
  then: Så
102
224
  and: Och
103
225
  but: Men
104
- "et":
105
- feature: Omadus
106
- scenario: Stsenaarium
107
- given_scenario: EeldadesStsenaariumit
108
- given: Eeldades
109
- when: Kui
110
- then: Siis
111
- and: Ja
112
- but: Kuid
226
+ # Chinese simplified
113
227
  "zh-CN":
228
+ feature: 功能
114
229
  scenario: 场景
115
230
  given_scenario: 引用场景
116
231
  given: 假如
@@ -9,7 +9,7 @@ else
9
9
  end
10
10
  require 'test/unit/testresult'
11
11
 
12
- # These allow exceptions to come through as opposed to being caught and hvaing non-helpful responses returned.
12
+ # These allow exceptions to come through as opposed to being caught and having non-helpful responses returned.
13
13
  ActionController::Base.class_eval do
14
14
  def perform_action
15
15
  perform_action_without_rescue
@@ -3,9 +3,9 @@ module Cucumber
3
3
  # Defines a task for running features.
4
4
  class Task
5
5
  LIB = File.expand_path(File.dirname(__FILE__) + '/../..')
6
- BINARY = File.expand_path(File.dirname(__FILE__) + '/../../../bin/cucumber')
7
6
 
8
7
  attr_accessor :libs
8
+ attr_accessor :binary
9
9
  attr_accessor :step_list
10
10
  attr_accessor :step_pattern
11
11
  attr_accessor :feature_list
@@ -13,7 +13,7 @@ module Cucumber
13
13
  attr_accessor :cucumber_opts
14
14
  attr_accessor :rcov
15
15
  attr_accessor :rcov_opts
16
-
16
+
17
17
  # Define a task
18
18
  def initialize(task_name = "features", desc = "Run Features with Cucumber")
19
19
  @task_name, @desc = task_name, desc
@@ -23,33 +23,39 @@ module Cucumber
23
23
  yield self if block_given?
24
24
 
25
25
  @feature_pattern = "features/**/*.feature" if feature_pattern.nil? && feature_list.nil?
26
- @step_pattern = "features/**/*.rb" if step_pattern.nil? && step_list.nil?
27
- define_tasks
26
+ @step_pattern = "features/**/*.rb" if step_pattern.nil? && step_list.nil?
27
+ @binary ||= File.expand_path(File.dirname(__FILE__) + '/../../../bin/cucumber')
28
+ define_task
28
29
  end
29
-
30
- def define_tasks
30
+
31
+ def define_task
31
32
  desc @desc
32
33
  task @task_name do
33
- lib_args = ['"%s"' % ([LIB] + libs).join(File::PATH_SEPARATOR)]
34
- cucumber_bin = ['"%s"' % BINARY]
35
- cuc_opts = [(ENV['CUCUMBER_OPTS'] || cucumber_opts)]
36
-
37
- step_files.each do |step_file|
38
- cuc_opts << '--require'
39
- cuc_opts << step_file
40
- end
41
-
42
- if rcov
43
- args = (['-I'] + lib_args + ['-S', 'rcov'] + rcov_opts + cucumber_bin + ['--'] + cuc_opts + feature_files).flatten
44
- else
45
- args = (['-I'] + lib_args + cucumber_bin + cuc_opts + feature_files).flatten
46
- end
47
- ruby(args.join(" ")) # ruby(*args) is broken on Windows
34
+ ruby(arguments_for_ruby_execution.join(" ")) # ruby(*args) is broken on Windows
48
35
  end
49
36
  end
50
37
 
38
+ def arguments_for_ruby_execution(task_args = nil)
39
+ lib_args = ['"%s"' % ([LIB] + libs).join(File::PATH_SEPARATOR)]
40
+ cucumber_bin = ['"%s"' % binary]
41
+ cuc_opts = [(ENV['CUCUMBER_OPTS'] || cucumber_opts)]
42
+
43
+ step_files(task_args).each do |step_file|
44
+ cuc_opts << '--require'
45
+ cuc_opts << step_file
46
+ end
51
47
 
52
- def feature_files # :nodoc:
48
+ if rcov
49
+ args = (['-I'] + lib_args + ['-S', 'rcov'] + rcov_opts +
50
+ cucumber_bin + ['--'] + cuc_opts + feature_files(task_args)).flatten
51
+ else
52
+ args = (['-I'] + lib_args + cucumber_bin + cuc_opts + feature_files(task_args)).flatten
53
+ end
54
+
55
+ args
56
+ end
57
+
58
+ def feature_files(task_args = nil) # :nodoc:
53
59
  if ENV['FEATURE']
54
60
  FileList[ ENV['FEATURE'] ]
55
61
  else
@@ -60,16 +66,36 @@ module Cucumber
60
66
  end
61
67
  end
62
68
 
63
- def step_files # :nodoc:
69
+ def step_files(task_args = nil) # :nodoc:
64
70
  if ENV['STEPS']
65
71
  FileList[ ENV['STEPS'] ]
66
72
  else
67
73
  result = []
68
- result += step_list.to_a if step_list
69
- result += FileList[step_pattern].to_a if step_pattern
74
+ result += Array(step_list) if step_list
75
+ result += Array(FileList[step_pattern]) if step_pattern
70
76
  FileList[result]
71
77
  end
72
78
  end
73
79
  end
80
+
81
+ class FeatureTask < Task
82
+
83
+ def initialize(task_name = "feature", desc = "Run a specified feature with Cucumber. #{task_name}[feature_name]")
84
+ super(task_name, desc)
85
+ end
86
+
87
+ def define_task
88
+ desc @desc
89
+ task @task_name, :feature_name do |t, args|
90
+ ruby(arguments_for_ruby_execution(args).join(" ")) # ruby(*args) is broken on Windows
91
+ end
92
+ end
93
+
94
+ def feature_files(task_arguments) # :nodoc:
95
+ FileList[File.join("features", "**", "#{task_arguments[:feature_name]}.feature")]
96
+ end
97
+
98
+ end
99
+
74
100
  end
75
- end
101
+ end
@@ -53,6 +53,7 @@ module Cucumber
53
53
  def regexp_args_proc(step_name)
54
54
  candidates = @step_procs.map do |regexp, proc|
55
55
  if step_name =~ regexp
56
+ proc = PENDING if proc.nil?
56
57
  [regexp, $~.captures, proc]
57
58
  end
58
59
  end.compact
@@ -76,8 +77,13 @@ module Cucumber
76
77
  @step_procs[regexp]
77
78
  end
78
79
 
80
+ def has_step_definition?(step_name)
81
+ _, _, proc = regexp_args_proc(step_name)
82
+ proc != PENDING
83
+ end
84
+
79
85
  # TODO - move execute here?
80
86
  def execute(step)
81
87
  end
82
88
  end
83
- end
89
+ end
@@ -1,10 +1,12 @@
1
1
  module Cucumber
2
2
  module Tree
3
3
  class Feature
4
+ attr_reader :header
5
+ attr_reader :scenarios
4
6
  MIN_PADDING = 2
5
-
7
+
6
8
  attr_accessor :file
7
-
9
+
8
10
  def initialize(header, &proc)
9
11
  @header = header
10
12
  @scenarios = []
@@ -16,7 +18,7 @@ module Cucumber
16
18
  @scenarios << scenario
17
19
  scenario
18
20
  end
19
-
21
+
20
22
  def add_row_scenario(template_scenario, values, line)
21
23
  scenario = RowScenario.new(self, template_scenario, values, line)
22
24
  @scenarios << scenario
@@ -34,13 +36,13 @@ module Cucumber
34
36
  def Scenario(name, &proc)
35
37
  add_scenario(name, &proc)
36
38
  end
37
-
39
+
38
40
  def Table(matrix = [], &proc)
39
41
  table = Table.new(matrix)
40
42
  proc.call(table)
41
43
  template_scenario = @scenarios.last
42
44
  matrix[1..-1].each do |row|
43
- @scenarios << RowScenario.new(self, template_scenario, row, row.line)
45
+ add_row_scenario(template_scenario, row, row.line)
44
46
  end
45
47
  end
46
48
 
@@ -56,4 +58,4 @@ module Cucumber
56
58
  end
57
59
  end
58
60
  end
59
- end
61
+ end