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
@@ -6,8 +6,6 @@ require 'yaml'
6
6
  module Cucumber
7
7
  version = YAML.load_file(File.dirname(__FILE__) + '/../../VERSION.yml')
8
8
  VERSION = [version[:major], version[:minor], version[:patch], version[:build]].compact.join('.')
9
- LANGUAGE_FILE = File.expand_path(File.dirname(__FILE__) + '/languages.yml')
10
- LANGUAGES = YAML.load_file(LANGUAGE_FILE)
11
9
  BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
12
10
  LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
13
11
  JRUBY = defined?(JRUBY_VERSION)
@@ -30,7 +30,12 @@ module Cucumber
30
30
  class RbLanguage
31
31
  include LanguageSupport::LanguageMethods
32
32
  attr_reader :current_world
33
-
33
+
34
+ Gherkin::I18n.code_keywords.each do |adverb|
35
+ RbDsl.alias_adverb(adverb)
36
+ RbWorld.alias_adverb(adverb)
37
+ end
38
+
34
39
  def initialize(step_mother)
35
40
  @step_mother = step_mother
36
41
  @step_definitions = []
@@ -38,16 +43,6 @@ module Cucumber
38
43
  @world_proc = @world_modules = nil
39
44
  end
40
45
 
41
- # Tell the language about other i18n translations so that
42
- # they can alias Given, When Then etc. Only useful if the language
43
- # has a mechanism for this - typically a dynamic language.
44
- def alias_adverbs(adverbs)
45
- adverbs.each do |adverb|
46
- RbDsl.alias_adverb(adverb)
47
- RbWorld.alias_adverb(adverb)
48
- end
49
- end
50
-
51
46
  # Gets called for each file under features (or whatever is overridden
52
47
  # with --require).
53
48
  def step_definitions_for(rb_file)
@@ -88,7 +83,7 @@ module Cucumber
88
83
  multiline_class_comment = "# #{multiline_arg_class.default_arg_name} is a #{multiline_arg_class.to_s}\n "
89
84
  end
90
85
 
91
- "#{step_keyword} /^#{escaped}$/ do#{block_arg_string}\n #{multiline_class_comment}pending # express the regexp above with the code you wish you had\nend"
86
+ "#{Gherkin::I18n.code_keyword_for(step_keyword)} /^#{escaped}$/ do#{block_arg_string}\n #{multiline_class_comment}pending # express the regexp above with the code you wish you had\nend"
92
87
  end
93
88
 
94
89
  def begin_rb_scenario(scenario)
@@ -1,6 +1,5 @@
1
1
  require 'cucumber/constantize'
2
2
  require 'cucumber/core_ext/instance_exec'
3
- require 'cucumber/parser/natural_language'
4
3
  require 'cucumber/language_support/language_methods'
5
4
  require 'cucumber/formatter/duration'
6
5
  require 'timeout'
@@ -49,7 +48,6 @@ module Cucumber
49
48
  @unsupported_programming_languages = []
50
49
  @programming_languages = []
51
50
  @language_map = {}
52
- load_natural_language('en')
53
51
  @current_scenario = nil
54
52
  end
55
53
 
@@ -96,20 +94,11 @@ module Cucumber
96
94
  return @language_map[ext] if @language_map[ext]
97
95
  programming_language_class = constantize("Cucumber::#{ext.capitalize}Support::#{ext.capitalize}Language")
98
96
  programming_language = programming_language_class.new(self)
99
- programming_language.alias_adverbs(@adverbs || [])
100
97
  @programming_languages << programming_language
101
98
  @language_map[ext] = programming_language
102
99
  programming_language
103
100
  end
104
101
 
105
- # Loads a natural language. This has the effect of aliasing
106
- # Step Definition keywords for all of the registered programming
107
- # languages (if they support aliasing). See #load_programming_language
108
- #
109
- def load_natural_language(lang)
110
- Parser::NaturalLanguage.get(self, lang)
111
- end
112
-
113
102
  # Returns the options passed on the command line.
114
103
  def options
115
104
  @options ||= {}
@@ -133,7 +122,7 @@ module Cucumber
133
122
  # nicer, and in all outputs (in case you use several formatters)
134
123
  #
135
124
  def announce(msg)
136
- @visitor.announce(msg.to_s)
125
+ msg.respond_to?(:join) ? @visitor.announce(msg.join("\n")) : @visitor.announce(msg.to_s)
137
126
  end
138
127
 
139
128
  # Suspends execution and prompts +question+ to the console (STDOUT).
@@ -240,8 +229,7 @@ module Cucumber
240
229
  if Array === text_or_table
241
230
  Ast::Table.new(text_or_table)
242
231
  else
243
- @table_parser ||= Parser::TableParser.new
244
- @table_parser.parse_or_fail(text_or_table.strip, file, line_offset)
232
+ Ast::Table.parse(text_or_table)
245
233
  end
246
234
  end
247
235
 
@@ -255,13 +243,12 @@ module Cucumber
255
243
  # Is retured as: " hello\nworld"
256
244
  #
257
245
  def py_string(string_with_triple_quotes, file=nil, line_offset=0)
258
- @py_string_parser ||= Parser::PyStringParser.new
259
- @py_string_parser.parse_or_fail(string_with_triple_quotes, file, line_offset).to_s
246
+ Ast::PyString.parse(string_with_triple_quotes)
260
247
  end
261
248
 
262
249
  def step_match(step_name, name_to_report=nil) #:nodoc:
263
250
  matches = @programming_languages.map do |programming_language|
264
- programming_language.step_matches(step_name, name_to_report)
251
+ programming_language.step_matches(step_name, name_to_report).to_a
265
252
  end.flatten
266
253
  raise Undefined.new(step_name) if matches.empty?
267
254
  matches = best_matches(step_name, matches) if matches.size > 1 && options[:guess]
@@ -309,15 +296,6 @@ module Cucumber
309
296
  scenario_visited(scenario)
310
297
  end
311
298
 
312
- def register_adverbs(adverbs) #:nodoc:
313
- @adverbs ||= []
314
- @adverbs += adverbs
315
- @adverbs.uniq!
316
- @programming_languages.each do |programming_language|
317
- programming_language.alias_adverbs(@adverbs)
318
- end
319
- end
320
-
321
299
  def before(scenario) #:nodoc:
322
300
  return if options[:dry_run] || @current_scenario
323
301
  @current_scenario = scenario
@@ -9,7 +9,6 @@ module Cucumber
9
9
  before do
10
10
  extend(Cucumber::RbSupport::RbDsl)
11
11
  @step_mother = Cucumber::StepMother.new
12
- @step_mother.load_natural_language('en')
13
12
  @rb = @step_mother.load_programming_language('rb')
14
13
 
15
14
  $x = $y = nil
@@ -24,10 +24,7 @@ module Cucumber
24
24
  %w{1 22 333},
25
25
  %w{4444 55555 666666}
26
26
  ])
27
- py_string = Ast::PyString.new(21, 22, %{
28
- I like
29
- Cucumber sandwich
30
- }, ' '*10)
27
+ py_string = Ast::PyString.new(%{\n I like\nCucumber sandwich\n})
31
28
 
32
29
  background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "",
33
30
  [
@@ -39,6 +36,7 @@ module Cucumber
39
36
  background,
40
37
  Ast::Comment.new("# My feature comment\n"),
41
38
  Ast::Tags.new(6, ['one', 'two']),
39
+ "Feature",
42
40
  "Pretty printing",
43
41
  [Ast::Scenario.new(
44
42
  background,
@@ -8,7 +8,6 @@ module Cucumber
8
8
 
9
9
  it "should convert to sexp" do
10
10
  step_mother = Cucumber::StepMother.new
11
- step_mother.load_natural_language('en')
12
11
  step_mother.load_programming_language('rb')
13
12
  dsl = Object.new
14
13
  dsl.extend Cucumber::RbSupport::RbDsl
@@ -47,7 +46,6 @@ module Cucumber
47
46
 
48
47
  it "should store OS specific file paths" do
49
48
  step_mother = Cucumber::StepMother.new
50
- step_mother.load_natural_language('en')
51
49
  step_mother.load_programming_language('rb')
52
50
  dsl = Object.new
53
51
  dsl.extend Cucumber::RbSupport::RbDsl
@@ -4,21 +4,10 @@ require 'cucumber/ast/py_string'
4
4
  module Cucumber
5
5
  module Ast
6
6
  describe PyString do
7
- it "should handle unindented" do
8
- ps = PyString.new(10, 13, "4.1\n4.2\n", "")
9
- ps.to_s.should == "4.1\n4.2\n"
10
- end
11
-
12
- it "should handle indented" do
13
- # """
14
- ps = PyString.new(10, 13, " 4.1\n 4.2\n", " ")
15
- ps.to_s.should == " 4.1\n 4.2\n"
16
- end
17
-
18
7
  describe "replacing arguments" do
19
8
 
20
9
  before(:each) do
21
- @ps = PyString.new(10, 13, "<book>\n<qty>\n", "")
10
+ @ps = PyString.new("<book>\n<qty>\n")
22
11
  end
23
12
 
24
13
  it "should return a new py_string with arguments replaced with values" do
@@ -34,7 +23,7 @@ module Cucumber
34
23
  end
35
24
 
36
25
  it "should replaced nil with empty string" do
37
- ps = PyString.new(10, 13, "'<book>'", "")
26
+ ps = PyString.new("'<book>'")
38
27
  py_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil})
39
28
 
40
29
  py_string_with_replaced_arg.to_s.should == "''"
@@ -10,7 +10,6 @@ module Cucumber
10
10
  before do
11
11
  @step_mother = Cucumber::StepMother.new
12
12
  @step_mother.load_programming_language('rb')
13
- @step_mother.load_natural_language('en')
14
13
  @dsl = Object.new
15
14
  @dsl.extend(Cucumber::RbSupport::RbDsl)
16
15
 
@@ -8,7 +8,6 @@ module Cucumber
8
8
  describe Scenario do
9
9
  before do
10
10
  @step_mother = Cucumber::StepMother.new
11
- @step_mother.load_natural_language('en')
12
11
  @step_mother.load_programming_language('rb')
13
12
  @dsl = Object.new
14
13
  @dsl.extend(Cucumber::RbSupport::RbDsl)
@@ -48,7 +48,7 @@ module Cucumber
48
48
  end
49
49
 
50
50
  it "should replace arguments in py string arg" do
51
- py_string = PyString.new(1, 2, 'taste_<taste> color_<color>', '')
51
+ py_string = PyString.new('taste_<taste> color_<color>')
52
52
 
53
53
  step = Step.new(1, 'Given', 'a <color> cucumber', py_string)
54
54
 
@@ -349,6 +349,7 @@ module Cucumber
349
349
  | a | b |
350
350
  | c | d |
351
351
  })
352
+ @t.should_not == nil
352
353
  end
353
354
 
354
355
  it "should raise on missing rows" do
@@ -409,8 +410,7 @@ module Cucumber
409
410
  end
410
411
 
411
412
  def table(text, file=nil, line_offset=0)
412
- @table_parser ||= Cucumber::Parser::TableParser.new
413
- @table_parser.parse_or_fail(text.strip, file, line_offset)
413
+ Table.parse(text)
414
414
  end
415
415
  end
416
416
 
@@ -20,7 +20,7 @@ module Cucumber
20
20
  describe "verbose mode" do
21
21
 
22
22
  before(:each) do
23
- @empty_feature = Cucumber::Ast::Feature.new(nil, Cucumber::Ast::Comment.new(''), Cucumber::Ast::Tags.new(2, []), "Feature", [])
23
+ @empty_feature = Cucumber::Ast::Feature.new(nil, Cucumber::Ast::Comment.new(''), Cucumber::Ast::Tags.new(2, []), "Feature", "Foo", [])
24
24
  end
25
25
 
26
26
  it "should show feature files parsed" do
@@ -56,10 +56,10 @@ module Cli
56
56
  context "with LANG specified as 'help'" do
57
57
  it "lists all known langues" do
58
58
  when_parsing '--i18n help' do
59
- require 'cucumber/cli/language_help_formatter'
60
- LanguageHelpFormatter.should_receive(:list_languages).with(output_stream)
59
+ Kernel.should_receive(:exit)
61
60
  end
62
61
  end
62
+
63
63
  it "exits the program" do
64
64
  when_parsing('--i18n help') { Kernel.should_receive(:exit) }
65
65
  end
@@ -25,7 +25,7 @@ module Cucumber
25
25
  end
26
26
 
27
27
  it "should not raise an error when visiting a blank feature name" do
28
- lambda { @formatter.feature_name("") }.should_not raise_error
28
+ lambda { @formatter.feature_name("Feature", "") }.should_not raise_error
29
29
  end
30
30
 
31
31
  describe "given a single feature" do
@@ -50,6 +50,7 @@ module Cucumber
50
50
  describe "with a comment" do
51
51
  define_feature <<-FEATURE
52
52
  # Healthy
53
+ Feature: Foo
53
54
  FEATURE
54
55
 
55
56
  it { @out.string.should =~ /^\<!DOCTYPE/ }
@@ -60,6 +61,7 @@ module Cucumber
60
61
  describe "with a tag" do
61
62
  define_feature <<-FEATURE
62
63
  @foo
64
+ Feature: can't have standalone tag :)
63
65
  FEATURE
64
66
 
65
67
  it { @doc.should have_css_node('.feature .tag', /foo/) }
@@ -90,6 +92,8 @@ module Cucumber
90
92
 
91
93
  describe "with a scenario" do
92
94
  define_feature <<-FEATURE
95
+ Feature: Banana party
96
+
93
97
  Scenario: Monkey eats banana
94
98
  Given there are bananas
95
99
  FEATURE
@@ -100,6 +104,8 @@ module Cucumber
100
104
 
101
105
  describe "with a scenario outline" do
102
106
  define_feature <<-FEATURE
107
+ Feature: Fud Pyramid
108
+
103
109
  Scenario Outline: Monkey eats a balanced diet
104
110
  Given there are <Things>
105
111
 
@@ -122,6 +128,8 @@ module Cucumber
122
128
 
123
129
  describe "with a step with a py string" do
124
130
  define_feature <<-FEATURE
131
+ Feature: Traveling circus
132
+
125
133
  Scenario: Monkey goes to town
126
134
  Given there is a monkey called:
127
135
  """
@@ -134,6 +142,8 @@ module Cucumber
134
142
 
135
143
  describe "with a multiline step arg" do
136
144
  define_feature <<-FEATURE
145
+ Feature: Traveling circus
146
+
137
147
  Scenario: Monkey goes to town
138
148
  Given there are monkeys:
139
149
  | name |
@@ -146,6 +156,8 @@ module Cucumber
146
156
 
147
157
  describe "with a table in the background and the scenario" do
148
158
  define_feature <<-FEATURE
159
+ Feature: accountant monkey
160
+
149
161
  Background:
150
162
  Given table:
151
163
  | a | b |
@@ -161,6 +173,8 @@ module Cucumber
161
173
 
162
174
  describe "with a py string in the background and the scenario" do
163
175
  define_feature <<-FEATURE
176
+ Feature: py strings
177
+
164
178
  Background:
165
179
  Given stuff:
166
180
  """
@@ -183,6 +197,8 @@ module Cucumber
183
197
  end
184
198
 
185
199
  define_feature(<<-FEATURE)
200
+ Feature: Animal Cruelty
201
+
186
202
  Scenario: Monkey gets a fright
187
203
  Given boo
188
204
  FEATURE
@@ -196,6 +212,7 @@ module Cucumber
196
212
  end
197
213
 
198
214
  define_feature(<<-FEATURE)
215
+ Feature: shouting
199
216
  Background:
200
217
  Given boo
201
218
  Scenario:
@@ -213,6 +230,7 @@ module Cucumber
213
230
  end
214
231
 
215
232
  define_feature(<<-FEATURE)
233
+ Feature:
216
234
  Scenario:
217
235
  Given snap
218
236
  FEATURE
@@ -222,6 +240,7 @@ module Cucumber
222
240
 
223
241
  describe "with an undefined Given step then an undefined And step" do
224
242
  define_feature(<<-FEATURE)
243
+ Feature:
225
244
  Scenario:
226
245
  Given some undefined step
227
246
  And another undefined step
@@ -25,6 +25,7 @@ module Cucumber::Formatter
25
25
 
26
26
  describe "a feature with no name" do
27
27
  define_feature <<-FEATURE
28
+ Feature:
28
29
  Scenario: Passing
29
30
  Given a passing scenario
30
31
  FEATURE
@@ -27,14 +27,12 @@ module Cucumber
27
27
  def load_features(content)
28
28
  feature_file = FeatureFile.new('spec.feature', content)
29
29
  features = Ast::Features.new
30
- feature = feature_file.parse(@step_mother, {})
31
- features.add_feature(feature)
30
+ feature = feature_file.parse(@step_mother, options)
31
+ features.add_feature(feature) if feature
32
32
  features
33
33
  end
34
34
 
35
35
  def run(features)
36
- # options = { :verbose => true }
37
- options = {}
38
36
  tree_walker = Cucumber::Ast::TreeWalker.new(@step_mother, [@formatter], options, STDOUT)
39
37
  tree_walker.visit_features(features)
40
38
  end
@@ -46,6 +44,10 @@ module Cucumber
46
44
  dsl.extend RbSupport::RbDsl
47
45
  dsl.instance_exec &step_defs
48
46
  end
47
+
48
+ def options
49
+ @options ||= mock(Cucumber::Cli::Options, :filters => [], :[] => nil)
50
+ end
49
51
  end
50
52
  end
51
- end
53
+ end
@@ -9,7 +9,6 @@ module Cucumber
9
9
  describe RbStepDefinition do
10
10
  before do
11
11
  @step_mother = Cucumber::StepMother.new
12
- @step_mother.load_natural_language('en')
13
12
  @rb = @step_mother.load_programming_language('rb')
14
13
  @dsl = Object.new
15
14
  @dsl.extend Cucumber::RbSupport::RbDsl
@@ -10,7 +10,7 @@ module Cucumber
10
10
  @dsl.extend(RbSupport::RbDsl)
11
11
 
12
12
  @step_mother = StepMother.new
13
- @step_mother.load_natural_language('en')
13
+
14
14
  @rb = @step_mother.load_programming_language('rb')
15
15
 
16
16
  @visitor = mock('Visitor')
@@ -179,7 +179,7 @@ or http://wiki.github.com/aslakhellesoy/cucumber/a-whole-new-world.
179
179
  @dsl.extend(RbSupport::RbDsl)
180
180
 
181
181
  @step_mother = StepMother.new
182
- @step_mother.load_natural_language('en')
182
+
183
183
  @rb = @step_mother.load_programming_language('rb')
184
184
  end
185
185