cucumber 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. data/.rvmrc +1 -1
  2. data/.travis.yml +3 -2
  3. data/DEVELOPERS.md +48 -0
  4. data/History.md +22 -3
  5. data/README.md +13 -31
  6. data/Rakefile +1 -0
  7. data/cucumber.gemspec +18 -17
  8. data/cucumber.yml +3 -2
  9. data/examples/i18n/cs/Rakefile +6 -0
  10. data/examples/i18n/cs/features/addition.feature +17 -0
  11. data/examples/i18n/cs/features/division.feature +11 -0
  12. data/examples/i18n/cs/features/step_definitons/calculator_steps.rb +24 -0
  13. data/examples/i18n/cs/lib/calculator.rb +14 -0
  14. data/examples/i18n/hi/Rakefile +6 -0
  15. data/examples/i18n/hi/features/addition.feature +16 -0
  16. data/examples/i18n/hi/features/division.feature +10 -0
  17. data/examples/i18n/hi/features/step_definitons/calculator_steps.rb +24 -0
  18. data/examples/i18n/hi/lib/calculator.rb +15 -0
  19. data/examples/python/README.textile +2 -1
  20. data/examples/ruby2python/README.textile +2 -1
  21. data/features/.cucumber/stepdefs.json +1688 -445
  22. data/features/assertions.feature +69 -0
  23. data/features/formatter_callbacks.feature +189 -0
  24. data/features/html_formatter.feature +19 -0
  25. data/features/json_formatter.feature +8 -4
  26. data/features/nested_steps_with_second_arg.feature +73 -0
  27. data/features/step_definitions.feature +65 -0
  28. data/features/step_definitions/cucumber_steps.rb +18 -3
  29. data/fixtures/self_test/features/support/env.rb +1 -1
  30. data/gem_tasks/cucumber.rake +5 -3
  31. data/gem_tasks/downloads.rb +3 -3
  32. data/gem_tasks/stats +4 -2
  33. data/gem_tasks/yard.rake +31 -13
  34. data/legacy_features/default_snippets.feature +3 -3
  35. data/legacy_features/language_help.feature +4 -0
  36. data/legacy_features/report_called_undefined_steps.feature +1 -1
  37. data/legacy_features/snippet.feature +3 -3
  38. data/legacy_features/snippets_when_using_star_keyword.feature +1 -1
  39. data/legacy_features/step_definitions/cucumber_steps.rb +4 -3
  40. data/legacy_features/support/env.rb +1 -1
  41. data/legacy_features/support/fake_wire_server.rb +9 -9
  42. data/lib/autotest/cucumber_mixin.rb +14 -14
  43. data/lib/autotest/discover.rb +2 -0
  44. data/lib/cucumber.rb +2 -2
  45. data/lib/cucumber/ast.rb +1 -1
  46. data/lib/cucumber/ast/background.rb +11 -7
  47. data/lib/cucumber/ast/comment.rb +2 -2
  48. data/lib/cucumber/ast/doc_string.rb +1 -1
  49. data/lib/cucumber/ast/examples.rb +1 -1
  50. data/lib/cucumber/ast/feature.rb +2 -2
  51. data/lib/cucumber/ast/feature_element.rb +1 -1
  52. data/lib/cucumber/ast/multiline_argument.rb +2 -2
  53. data/lib/cucumber/ast/names.rb +2 -2
  54. data/lib/cucumber/ast/outline_table.rb +4 -5
  55. data/lib/cucumber/ast/scenario.rb +14 -14
  56. data/lib/cucumber/ast/scenario_outline.rb +4 -4
  57. data/lib/cucumber/ast/step.rb +3 -3
  58. data/lib/cucumber/ast/step_collection.rb +5 -5
  59. data/lib/cucumber/ast/step_invocation.rb +8 -8
  60. data/lib/cucumber/ast/table.rb +40 -27
  61. data/lib/cucumber/ast/tree_walker.rb +9 -8
  62. data/lib/cucumber/ast/visitor.rb +1 -1
  63. data/lib/cucumber/cli/configuration.rb +10 -10
  64. data/lib/cucumber/cli/drb_client.rb +1 -1
  65. data/lib/cucumber/cli/main.rb +3 -3
  66. data/lib/cucumber/cli/options.rb +3 -2
  67. data/lib/cucumber/cli/profile_loader.rb +1 -1
  68. data/lib/cucumber/configuration.rb +12 -12
  69. data/lib/cucumber/constantize.rb +11 -2
  70. data/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +1 -1
  71. data/lib/cucumber/core_ext/instance_exec.rb +4 -4
  72. data/lib/cucumber/core_ext/proc.rb +3 -3
  73. data/lib/cucumber/errors.rb +1 -1
  74. data/lib/cucumber/feature_file.rb +1 -1
  75. data/lib/cucumber/formatter/ansicolor.rb +36 -23
  76. data/lib/cucumber/formatter/console.rb +45 -25
  77. data/lib/cucumber/formatter/debug.rb +7 -7
  78. data/lib/cucumber/formatter/duration.rb +1 -1
  79. data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +7 -0
  80. data/lib/cucumber/formatter/gpretty.rb +1 -1
  81. data/lib/cucumber/formatter/html.rb +52 -53
  82. data/lib/cucumber/formatter/interceptor.rb +2 -2
  83. data/lib/cucumber/formatter/json.rb +1 -1
  84. data/lib/cucumber/formatter/json_pretty.rb +2 -1
  85. data/lib/cucumber/formatter/junit.rb +1 -1
  86. data/lib/cucumber/formatter/ordered_xml_markup.rb +1 -1
  87. data/lib/cucumber/formatter/pretty.rb +12 -12
  88. data/lib/cucumber/formatter/progress.rb +5 -5
  89. data/lib/cucumber/formatter/rerun.rb +5 -5
  90. data/lib/cucumber/formatter/stepdefs.rb +1 -1
  91. data/lib/cucumber/formatter/steps.rb +6 -6
  92. data/lib/cucumber/formatter/summary.rb +6 -6
  93. data/lib/cucumber/formatter/unicode.rb +18 -18
  94. data/lib/cucumber/formatter/usage.rb +7 -7
  95. data/lib/cucumber/js_support/js_dsl.js +1 -1
  96. data/lib/cucumber/language_support.rb +1 -1
  97. data/lib/cucumber/parser/gherkin_builder.rb +33 -33
  98. data/lib/cucumber/platform.rb +3 -2
  99. data/lib/cucumber/py_support/py_dsl.py +2 -2
  100. data/lib/cucumber/py_support/py_language.py +2 -2
  101. data/lib/cucumber/py_support/py_language.rb +2 -2
  102. data/lib/cucumber/rake/task.rb +4 -3
  103. data/lib/cucumber/rb_support/rb_dsl.rb +10 -10
  104. data/lib/cucumber/rb_support/rb_language.rb +27 -19
  105. data/lib/cucumber/rb_support/rb_step_definition.rb +39 -11
  106. data/lib/cucumber/rb_support/rb_transform.rb +3 -3
  107. data/lib/cucumber/rb_support/rb_world.rb +15 -15
  108. data/lib/cucumber/rb_support/regexp_argument_matcher.rb +1 -1
  109. data/lib/cucumber/rspec/disable_option_parser.rb +1 -1
  110. data/lib/cucumber/rspec/doubles.rb +1 -1
  111. data/lib/cucumber/runtime.rb +11 -10
  112. data/lib/cucumber/runtime/features_loader.rb +6 -6
  113. data/lib/cucumber/runtime/for_programming_languages.rb +8 -15
  114. data/lib/cucumber/runtime/results.rb +6 -6
  115. data/lib/cucumber/runtime/support_code.rb +37 -28
  116. data/lib/cucumber/runtime/user_interface.rb +4 -4
  117. data/lib/cucumber/step_definition_light.rb +4 -4
  118. data/lib/cucumber/step_definitions.rb +2 -3
  119. data/lib/cucumber/step_match.rb +6 -6
  120. data/lib/cucumber/step_mother.rb +1 -1
  121. data/lib/cucumber/term/ansicolor.rb +22 -22
  122. data/lib/cucumber/wire_support/configuration.rb +11 -14
  123. data/lib/cucumber/wire_support/connection.rb +10 -9
  124. data/lib/cucumber/wire_support/request_handler.rb +3 -3
  125. data/lib/cucumber/wire_support/wire_exception.rb +3 -3
  126. data/lib/cucumber/wire_support/wire_language.rb +11 -11
  127. data/lib/cucumber/wire_support/wire_packet.rb +7 -5
  128. data/lib/cucumber/wire_support/wire_protocol.rb +6 -6
  129. data/lib/cucumber/wire_support/wire_protocol/requests.rb +20 -20
  130. data/lib/cucumber/wire_support/wire_step_definition.rb +4 -4
  131. data/spec/cucumber/ast/background_spec.rb +4 -4
  132. data/spec/cucumber/ast/doc_string_spec.rb +8 -8
  133. data/spec/cucumber/ast/feature_factory.rb +4 -4
  134. data/spec/cucumber/ast/feature_spec.rb +18 -18
  135. data/spec/cucumber/ast/outline_table_spec.rb +3 -3
  136. data/spec/cucumber/ast/step_spec.rb +4 -4
  137. data/spec/cucumber/ast/table_spec.rb +50 -29
  138. data/spec/cucumber/ast/tree_walker_spec.rb +12 -4
  139. data/spec/cucumber/broadcaster_spec.rb +1 -1
  140. data/spec/cucumber/cli/configuration_spec.rb +10 -4
  141. data/spec/cucumber/cli/drb_client_spec.rb +1 -1
  142. data/spec/cucumber/cli/main_spec.rb +28 -7
  143. data/spec/cucumber/cli/options_spec.rb +3 -3
  144. data/spec/cucumber/configuration_spec.rb +4 -4
  145. data/spec/cucumber/constantize_spec.rb +2 -0
  146. data/spec/cucumber/core_ext/proc_spec.rb +7 -7
  147. data/spec/cucumber/formatter/ansicolor_spec.rb +2 -2
  148. data/spec/cucumber/formatter/duration_spec.rb +2 -2
  149. data/spec/cucumber/formatter/html_spec.rb +31 -31
  150. data/spec/cucumber/formatter/interceptor_spec.rb +10 -0
  151. data/spec/cucumber/formatter/progress_spec.rb +1 -1
  152. data/spec/cucumber/formatter/spec_helper.rb +7 -7
  153. data/spec/cucumber/rake/forked_spec.rb +15 -2
  154. data/spec/cucumber/rake/rcov_spec.rb +2 -2
  155. data/spec/cucumber/rb_support/rb_language_spec.rb +34 -17
  156. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +45 -35
  157. data/spec/cucumber/rb_support/rb_transform_spec.rb +3 -3
  158. data/spec/cucumber/runtime/for_programming_languages_spec.rb +31 -0
  159. data/spec/cucumber/runtime/results_spec.rb +5 -5
  160. data/spec/cucumber/runtime/support_code_spec.rb +13 -2
  161. data/spec/cucumber/runtime_spec.rb +7 -7
  162. data/spec/cucumber/step_match_spec.rb +2 -2
  163. data/spec/cucumber/wire_support/configuration_spec.rb +16 -6
  164. data/spec/cucumber/wire_support/connection_spec.rb +25 -11
  165. data/spec/cucumber/wire_support/wire_exception_spec.rb +3 -3
  166. data/spec/cucumber/wire_support/wire_language_spec.rb +3 -3
  167. data/spec/cucumber/wire_support/wire_packet_spec.rb +4 -4
  168. data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
  169. data/spec/spec_helper.rb +2 -2
  170. metadata +98 -128
  171. data/legacy_features/html_formatter.feature +0 -8
  172. data/legacy_features/html_formatter/a.html +0 -561
@@ -2,25 +2,25 @@ module Cucumber
2
2
  module WireSupport
3
3
  class WireStepDefinition
4
4
  attr_reader :regexp_source, :file_colon_line
5
-
5
+
6
6
  def initialize(connection, data)
7
7
  @connection = connection
8
8
  @id = data['id']
9
9
  @regexp_source = data['regexp'] || "Unknown"
10
10
  @file_colon_line = data['source'] || "Unknown"
11
11
  end
12
-
12
+
13
13
  def invoke(args)
14
14
  prepared_args = args.map{ |arg| prepare(arg) }
15
15
  @connection.invoke(@id, prepared_args)
16
16
  end
17
17
 
18
18
  private
19
-
19
+
20
20
  def prepare(arg)
21
21
  return arg unless arg.is_a?(Cucumber::Ast::Table)
22
22
  arg.raw
23
23
  end
24
24
  end
25
25
  end
26
- end
26
+ end
@@ -28,7 +28,7 @@ module Cucumber
28
28
  background = Background.new(
29
29
  comment=Comment.new(''),
30
30
  line=2,
31
- keyword="",
31
+ keyword="",
32
32
  title="",
33
33
  description="",
34
34
  steps=[
@@ -37,10 +37,10 @@ module Cucumber
37
37
 
38
38
  scenario = Scenario.new(
39
39
  background,
40
- comment=Comment.new(""),
40
+ comment=Comment.new(""),
41
41
  tags=Tags.new(98,[]),
42
42
  line=99,
43
- keyword="",
43
+ keyword="",
44
44
  title="",
45
45
  description="",
46
46
  steps=[]
@@ -110,6 +110,6 @@ module Cucumber
110
110
 
111
111
  end
112
112
  end
113
-
113
+
114
114
  end
115
115
  end
@@ -9,23 +9,23 @@ module Cucumber
9
9
  before(:each) do
10
10
  @ps = DocString.new("<book>\n<qty>\n", '')
11
11
  end
12
-
12
+
13
13
  it "should return a new doc_string with arguments replaced with values" do
14
14
  doc_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere', '<qty>' => '5'})
15
-
15
+
16
16
  doc_string_with_replaced_arg.to_step_definition_arg.should == "Life is elsewhere\n5\n"
17
17
  end
18
-
18
+
19
19
  it "should not change the original doc_string" do
20
20
  doc_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere'})
21
-
21
+
22
22
  @ps.to_s.should_not include("Life is elsewhere")
23
23
  end
24
24
 
25
25
  it "should replaced nil with empty string" do
26
26
  ps = DocString.new("'<book>'", '')
27
- doc_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil})
28
-
27
+ doc_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil})
28
+
29
29
  doc_string_with_replaced_arg.to_step_definition_arg.should == "''"
30
30
  end
31
31
 
@@ -34,7 +34,7 @@ module Cucumber
34
34
  end
35
35
 
36
36
  end
37
-
37
+
38
38
  end
39
39
  end
40
- end
40
+ end
@@ -10,7 +10,7 @@ module Cucumber
10
10
  raise "I flunked"
11
11
  end
12
12
  end
13
-
13
+
14
14
  def create_feature(dsl)
15
15
  dsl.Given /^a (.*) step with an inline arg:$/ do |what, table|
16
16
  end
@@ -26,13 +26,13 @@ module Cucumber
26
26
  %w{4444 55555 666666}
27
27
  ])
28
28
  doc_string = Ast::DocString.new(%{\n I like\nCucumber sandwich\n}, '')
29
-
29
+
30
30
  background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "", "",
31
31
  [
32
32
  Step.new(3, "Given", "a passing step")
33
33
  ]
34
34
  )
35
-
35
+
36
36
  f = Ast::Feature.new(
37
37
  background,
38
38
  Ast::Comment.new("# My feature comment\n"),
@@ -59,4 +59,4 @@ module Cucumber
59
59
  end
60
60
  end
61
61
  end
62
- end
62
+ end
@@ -9,7 +9,7 @@ module Cucumber
9
9
  it "should convert to sexp" do
10
10
  step_mother = Cucumber::Runtime.new
11
11
  step_mother.load_programming_language('rb')
12
- dsl = Object.new
12
+ dsl = Object.new
13
13
  dsl.extend Cucumber::RbSupport::RbDsl
14
14
 
15
15
  feature = create_feature(dsl)
@@ -18,36 +18,36 @@ module Cucumber
18
18
  else
19
19
  feature_file_path = "features/pretty_printing.feature"
20
20
  end
21
- feature.to_sexp.should ==
21
+ feature.to_sexp.should ==
22
22
  [:feature,
23
23
  feature_file_path,
24
- "Pretty printing",
25
- [:comment, "# My feature comment\n"],
26
- [:tag, "one"],
27
- [:tag, "two"],
24
+ "Pretty printing",
25
+ [:comment, "# My feature comment\n"],
26
+ [:tag, "one"],
27
+ [:tag, "two"],
28
28
  [:background, 2, 'Background:',
29
29
  [:step, 3, "Given", "a passing step"]],
30
- [:scenario, 9, "Scenario:",
31
- "A Scenario",
32
- [:comment, " # My scenario comment \n# On two lines \n"],
33
- [:tag, "three"],
30
+ [:scenario, 9, "Scenario:",
31
+ "A Scenario",
32
+ [:comment, " # My scenario comment \n# On two lines \n"],
33
+ [:tag, "three"],
34
34
  [:tag, "four"],
35
35
  [:step_invocation, 3, "Given", "a passing step"], # From the background
36
36
  [:step_invocation, 10, "Given", "a passing step with an inline arg:",
37
- [:table,
37
+ [:table,
38
38
  [:row, -1,
39
- [:cell, "1"], [:cell, "22"], [:cell, "333"]],
39
+ [:cell, "1"], [:cell, "22"], [:cell, "333"]],
40
40
  [:row, -1,
41
- [:cell, "4444"], [:cell, "55555"], [:cell, "666666"]]]],
42
- [:step_invocation, 11, "Given", "a happy step with an inline arg:",
43
- [:doc_string, "\n I like\nCucumber sandwich\n"]],
44
- [:step_invocation, 12, "Given", "a failing step"]]]
41
+ [:cell, "4444"], [:cell, "55555"], [:cell, "666666"]]]],
42
+ [:step_invocation, 11, "Given", "a happy step with an inline arg:",
43
+ [:doc_string, "\n I like\nCucumber sandwich\n"]],
44
+ [:step_invocation, 12, "Given", "a failing step"]]]
45
45
  end
46
46
 
47
47
  it "should store OS specific file paths" do
48
48
  step_mother = Cucumber::Runtime.new
49
49
  step_mother.load_programming_language('rb')
50
- dsl = Object.new
50
+ dsl = Object.new
51
51
  dsl.extend Cucumber::RbSupport::RbDsl
52
52
  feature = create_feature(dsl)
53
53
 
@@ -55,7 +55,7 @@ module Cucumber
55
55
  feature.file.should == 'features\pretty_printing.feature'
56
56
  else
57
57
  feature.file.should == 'features/pretty_printing.feature'
58
- end
58
+ end
59
59
  end
60
60
 
61
61
  end
@@ -6,11 +6,11 @@ module Cucumber::Ast
6
6
  describe "a header row" do
7
7
  before(:each) do
8
8
  @row = OutlineTable::ExampleRow.new(
9
- mock('table', :index => 0),
9
+ mock('table', :index => 0),
10
10
  [mock('cell', :status= => nil)]
11
11
  )
12
12
  end
13
-
13
+
14
14
  it "should raise an error if you try to call #failed?" do
15
15
  @row.accept_plain mock('visitor', :visit_table_cell => nil)
16
16
  lambda{ @row.failed? }.should raise_error(NoMethodError, /cannot pass or fail/)
@@ -18,4 +18,4 @@ module Cucumber::Ast
18
18
  end
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -15,7 +15,7 @@ module Cucumber
15
15
  ])
16
16
  cells = invocation_table.cells_rows[1]
17
17
  step_invocation = step.step_invocation_from_cells(cells)
18
-
18
+
19
19
  step_invocation.name.should == 'a green cucumber'
20
20
  end
21
21
 
@@ -28,7 +28,7 @@ module Cucumber
28
28
  ])
29
29
  cells = invocation_table.cells_rows[1]
30
30
  step_invocation = step.step_invocation_from_cells(cells)
31
-
31
+
32
32
  step_invocation.name.should == 'a cucumber'
33
33
  end
34
34
 
@@ -43,7 +43,7 @@ module Cucumber
43
43
  ])
44
44
  cells = invocation_table.cells_rows[1]
45
45
  step_invocation = step.step_invocation_from_cells(cells)
46
-
46
+
47
47
  step_invocation.instance_variable_get('@multiline_arg').raw.should == [%w{taste_juicy color_green}]
48
48
  end
49
49
 
@@ -58,7 +58,7 @@ module Cucumber
58
58
  ])
59
59
  cells = invocation_table.cells_rows[1]
60
60
  step_invocation = step.step_invocation_from_cells(cells)
61
-
61
+
62
62
  step_invocation.instance_variable_get('@multiline_arg').to_step_definition_arg.should == 'taste_juicy color_green'
63
63
  end
64
64
  end
@@ -54,7 +54,7 @@ module Cucumber
54
54
  @table.map_column!('one') { |v| v.to_i }
55
55
  @table.hashes.first['one'].should == 4444
56
56
  end
57
-
57
+
58
58
  it "applies the block once to each value" do
59
59
  headers = ['header']
60
60
  rows = ['value']
@@ -102,7 +102,7 @@ module Cucumber
102
102
  %w{4444 55555 666666}
103
103
  ])
104
104
  end
105
-
105
+
106
106
  it "returns nil if headers do not match" do
107
107
  @table.match('does,not,match').should be_nil
108
108
  end
@@ -121,14 +121,14 @@ module Cucumber
121
121
  %w{two 22222}
122
122
  ])
123
123
  end
124
-
125
- it "should be convertible in to an array where each row is a hash" do
124
+
125
+ it "should be convertible in to an array where each row is a hash" do
126
126
  @table.transpose.hashes[0].should == {'one' => '1111', 'two' => '22222'}
127
127
  end
128
128
  end
129
-
129
+
130
130
  describe "#rows_hash" do
131
-
131
+
132
132
  it "should return a hash of the rows" do
133
133
  table = Table.new([
134
134
  %w{one 1111},
@@ -201,6 +201,33 @@ module Cucumber
201
201
  table.hashes.first.keys.should =~ %w[hello foo]
202
202
  end
203
203
 
204
+ it "should allow mapping of headers before table.hashes has been accessed" do
205
+ table = Table.new([
206
+ ['HELLO', 'WORLD'],
207
+ %w{4444 55555}
208
+ ])
209
+
210
+ table.map_headers! do |header|
211
+ header.downcase
212
+ end
213
+
214
+ table.hashes.first.keys.should =~ %w[hello world]
215
+ end
216
+
217
+ it "should allow mapping of headers after table.hashes has been accessed" do
218
+ table = Table.new([
219
+ ['HELLO', 'WORLD'],
220
+ %w{4444 55555}
221
+ ])
222
+
223
+ dev_null = table.hashes.size
224
+
225
+ table.map_headers! do |header|
226
+ header.downcase
227
+ end
228
+
229
+ table.hashes.first.keys.should =~ %w[hello world]
230
+ end
204
231
  end
205
232
 
206
233
  describe "replacing arguments" do
@@ -243,7 +270,7 @@ module Cucumber
243
270
  %w{cat}
244
271
  ])
245
272
  table_with_replaced_args = table.arguments_replaced({'<book>' => nil})
246
-
273
+
247
274
  table_with_replaced_args.hashes[0]['book'].should == 'cat'
248
275
  end
249
276
 
@@ -258,13 +285,13 @@ module Cucumber
258
285
  ['book', 'qty'],
259
286
  ['<book>', nil],
260
287
  ])
261
- lambda{
288
+ lambda{
262
289
  table.arguments_replaced({'<book>' => nil, '<qty>' => '5'})
263
290
  }.should_not raise_error
264
291
  end
265
292
 
266
293
  end
267
-
294
+
268
295
  describe "diff!" do
269
296
  it "should detect a complex diff" do
270
297
  t1 = table(%{
@@ -273,11 +300,11 @@ module Cucumber
273
300
  | 999999999 | 0000000000 | 01010101010 | 121212121212 |
274
301
  | 4000 | ABC | DEF | 50000 |
275
302
  }, __FILE__, __LINE__)
276
-
303
+
277
304
  t2 = table(%{
278
- | a | 4444 | 1 |
279
- | bb | 88888888 | 55555 |
280
- | ccc | xxxxxxxx | 999999999 |
305
+ | a | 4444 | 1 |
306
+ | bb | 88888888 | 55555 |
307
+ | ccc | xxxxxxxx | 999999999 |
281
308
  | dddd | 4000 | 300 |
282
309
  | e | 50000 | 4000 |
283
310
  }, __FILE__, __LINE__)
@@ -346,7 +373,7 @@ module Cucumber
346
373
  ['name', 'male'],
347
374
  ['aslak', true]
348
375
  ])
349
- t1.map_column!('male') {
376
+ t1.map_column!('male') {
350
377
  'true'
351
378
  }
352
379
  t2 = Table.new([
@@ -405,7 +432,7 @@ module Cucumber
405
432
  t1.hashes
406
433
  end.should raise_error(%{2 headers matched /uk/: ["Cuke", "Duke"]})
407
434
  end
408
-
435
+
409
436
  describe "raising" do
410
437
  before do
411
438
  @t = table(%{
@@ -414,7 +441,7 @@ module Cucumber
414
441
  }, __FILE__, __LINE__)
415
442
  @t.should_not == nil
416
443
  end
417
-
444
+
418
445
  it "should raise on missing rows" do
419
446
  t = table(%{
420
447
  | a | b |
@@ -448,13 +475,7 @@ module Cucumber
448
475
  }, __FILE__, __LINE__)
449
476
  lambda { t1.dup.diff!(t2) }.should raise_error
450
477
 
451
- begin
452
- pending "http://groups.google.com/group/cukes/browse_thread/thread/5d96431c8245f05f" do
453
- lambda { t1.dup.diff!(t2, :surplus_row => false) }.should_not raise_error
454
- end
455
- rescue => e
456
- warn(e.message + " - see http://www.ruby-forum.com/topic/208508")
457
- end
478
+ lambda { t1.dup.diff!(t2, :surplus_row => false) }.should_not raise_error
458
479
  end
459
480
 
460
481
  it "should raise on missing columns" do
@@ -494,22 +515,22 @@ module Cucumber
494
515
  it "should allow Array of Hash" do
495
516
  t1 = Table.new([{'name' => 'aslak', 'male' => 'true'}])
496
517
  t1.to_s(:indent => 12, :color => false).should == %{
497
- | name | male |
498
- | aslak | true |
518
+ | male | name |
519
+ | true | aslak |
499
520
  }
500
521
  end
501
522
  end
502
523
 
503
524
  it "should convert to sexp" do
504
- @table.to_sexp.should ==
505
- [:table,
525
+ @table.to_sexp.should ==
526
+ [:table,
506
527
  [:row, -1,
507
- [:cell, "one"],
528
+ [:cell, "one"],
508
529
  [:cell, "four"],
509
530
  [:cell, "seven"]
510
531
  ],
511
532
  [:row, -1,
512
- [:cell, "4444"],
533
+ [:cell, "4444"],
513
534
  [:cell, "55555"],
514
535
  [:cell, "666666"]]]
515
536
  end
@@ -2,10 +2,18 @@ require 'spec_helper'
2
2
 
3
3
  module Cucumber::Ast
4
4
  describe TreeWalker do
5
+ let(:tree_walker) do
6
+ TreeWalker.new(nil, [mock('listener', :before_visit_features => nil)])
7
+ end
8
+ let(:features) { mock('features', :accept => nil) }
9
+
5
10
  it "should visit features" do
6
- tw = TreeWalker.new(nil, [mock('listener', :before_visit_features => nil)])
7
- tw.should_not_receive(:warn)
8
- tw.visit_features(mock('features', :accept => nil))
11
+ tree_walker.should_not_receive(:warn)
12
+ tree_walker.visit_features(features)
13
+ end
14
+
15
+ it "should return self" do
16
+ tree_walker.visit_features(features).should == tree_walker
9
17
  end
10
18
  end
11
- end
19
+ end