cucumber 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -36,10 +36,10 @@ module Cucumber
36
36
  case pipe
37
37
  when :stdout
38
38
  wrapped = $stdout
39
- $stdout = wrapped.unwrap!
39
+ $stdout = wrapped.unwrap! if $stdout.respond_to?(:unwrap!)
40
40
  when :stderr
41
41
  wrapped = $stderr
42
- $stderr = wrapped.unwrap!
42
+ $stderr = wrapped.unwrap! if $stderr.respond_to?(:unwrap!)
43
43
  end
44
44
  wrapped
45
45
  end
@@ -9,7 +9,7 @@ module Cucumber
9
9
  class Json < GherkinFormatterAdapter
10
10
  include Io
11
11
 
12
- def initialize(step_mother, io, options)
12
+ def initialize(runtime, io, options)
13
13
  @io = ensure_io(io, "json")
14
14
  super(Gherkin::Formatter::JSONFormatter.new(@io), false)
15
15
  end
@@ -1,3 +1,4 @@
1
+ require 'multi_json'
1
2
  require 'cucumber/formatter/json'
2
3
 
3
4
  module Cucumber
@@ -5,7 +6,7 @@ module Cucumber
5
6
  # The formatter used for <tt>--format json_pretty</tt>
6
7
  class JsonPretty < Json
7
8
  def after_features(features)
8
- @io.write(JSON.pretty_generate(@obj))
9
+ @io.write(MultiJson.dump(@obj, :pretty => true))
9
10
  end
10
11
  end
11
12
  end
@@ -15,7 +15,7 @@ module Cucumber
15
15
  end
16
16
  end
17
17
 
18
- def initialize(step_mother, io, options)
18
+ def initialize(runtime, io, options)
19
19
  @reportdir = ensure_dir(io, "junit")
20
20
  @options = options
21
21
  end
@@ -21,4 +21,4 @@ module Cucumber
21
21
  end
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -18,10 +18,10 @@ module Cucumber
18
18
  include Io
19
19
  include Gherkin::Formatter::Escaping
20
20
  attr_writer :indent
21
- attr_reader :step_mother
21
+ attr_reader :runtime
22
22
 
23
- def initialize(step_mother, path_or_io, options)
24
- @step_mother, @io, @options = step_mother, ensure_io(path_or_io, "pretty"), options
23
+ def initialize(runtime, path_or_io, options)
24
+ @runtime, @io, @options = runtime, ensure_io(path_or_io, "pretty"), options
25
25
  @exceptions = []
26
26
  @indent = 0
27
27
  @prefixes = options[:prefixes] || {}
@@ -42,7 +42,7 @@ module Cucumber
42
42
  @io = ensure_file(file, "pretty")
43
43
  end
44
44
  end
45
-
45
+
46
46
  def comment_line(comment_line)
47
47
  @io.puts(comment_line.indent(@indent))
48
48
  @io.flush
@@ -72,7 +72,7 @@ module Cucumber
72
72
  @indent = 2
73
73
  @scenario_indent = 2
74
74
  end
75
-
75
+
76
76
  def after_feature_element(feature_element)
77
77
  @io.puts
78
78
  @io.flush
@@ -90,7 +90,7 @@ module Cucumber
90
90
  @io.flush
91
91
  end
92
92
 
93
- def background_name(keyword, name, file_colon_line, source_indent)
93
+ def background_name(keyword, name, file_colon_line, source_indent)
94
94
  print_feature_element_name(keyword, name, file_colon_line, source_indent)
95
95
  end
96
96
 
@@ -99,7 +99,7 @@ module Cucumber
99
99
  @io.puts
100
100
  @visiting_first_example_name = true
101
101
  end
102
-
102
+
103
103
  def examples_name(keyword, name)
104
104
  @io.puts unless @visiting_first_example_name
105
105
  @visiting_first_example_name = false
@@ -110,7 +110,7 @@ module Cucumber
110
110
  @indent = 6
111
111
  @scenario_indent = 6
112
112
  end
113
-
113
+
114
114
  def before_outline_table(outline_table)
115
115
  @table = outline_table
116
116
  end
@@ -119,7 +119,7 @@ module Cucumber
119
119
  @table = nil
120
120
  @indent = 4
121
121
  end
122
-
122
+
123
123
  def scenario_name(keyword, name, file_colon_line, source_indent)
124
124
  print_feature_element_name(keyword, name, file_colon_line, source_indent)
125
125
  end
@@ -171,7 +171,7 @@ module Cucumber
171
171
  return if @options[:no_multiline] || @hide_this_step
172
172
  @table = multiline_arg
173
173
  end
174
-
174
+
175
175
  def after_multiline_arg(multiline_arg)
176
176
  @table = nil
177
177
  end
@@ -208,7 +208,7 @@ module Cucumber
208
208
  end
209
209
 
210
210
  private
211
-
211
+
212
212
  def print_feature_element_name(keyword, name, file_colon_line, source_indent)
213
213
  @io.puts if @scenario_indent == 6
214
214
  names = name.empty? ? [name] : name.split("\n")
@@ -220,7 +220,7 @@ module Cucumber
220
220
  end
221
221
  @io.puts
222
222
  names[1..-1].each {|s| @io.puts " #{s}"}
223
- @io.flush
223
+ @io.flush
224
224
  end
225
225
 
226
226
  def cell_prefix(status)
@@ -7,10 +7,10 @@ module Cucumber
7
7
  class Progress
8
8
  include Console
9
9
  include Io
10
- attr_reader :step_mother
10
+ attr_reader :runtime
11
11
 
12
- def initialize(step_mother, path_or_io, options)
13
- @step_mother, @io, @options = step_mother, ensure_io(path_or_io, "progress"), options
12
+ def initialize(runtime, path_or_io, options)
13
+ @runtime, @io, @options = runtime, ensure_io(path_or_io, "progress"), options
14
14
  end
15
15
 
16
16
  def after_features(features)
@@ -24,12 +24,12 @@ module Cucumber
24
24
  end
25
25
 
26
26
  def after_feature_element(*args)
27
- progress(:failed) if @exception_raised
27
+ progress(:failed) if (defined? @exception_raised) and (@exception_raised)
28
28
  @exception_raised = false
29
29
  end
30
30
 
31
31
  def before_steps(*args)
32
- progress(:failed) if @exception_raised
32
+ progress(:failed) if (defined? @exception_raised) and (@exception_raised)
33
33
  @exception_raised = false
34
34
  end
35
35
 
@@ -15,18 +15,18 @@ module Cucumber
15
15
  class Rerun
16
16
  include Io
17
17
 
18
- def initialize(step_mother, path_or_io, options)
18
+ def initialize(runtime, path_or_io, options)
19
19
  @io = ensure_io(path_or_io, "rerun")
20
20
  @options = options
21
21
  @file_names = []
22
22
  @file_colon_lines = Hash.new{|h,k| h[k] = []}
23
23
  end
24
-
24
+
25
25
  def before_feature(feature_element)
26
26
  @lines = []
27
27
  @file = feature_element.file
28
28
  end
29
-
29
+
30
30
  def after_feature(*)
31
31
  unless @lines.empty?
32
32
  after_first_time do
@@ -67,7 +67,7 @@ module Cucumber
67
67
  @header_row = true
68
68
  @in_examples = true
69
69
  end
70
-
70
+
71
71
  def after_examples(*args)
72
72
  @in_examples = false
73
73
  end
@@ -81,7 +81,7 @@ module Cucumber
81
81
  end
82
82
 
83
83
  private
84
-
84
+
85
85
  def after_first_time
86
86
  yield if @not_first_time
87
87
  @not_first_time = true
@@ -11,4 +11,4 @@ module Cucumber
11
11
  end
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -3,10 +3,10 @@ module Cucumber
3
3
  # The formatter used for <tt>--format steps</tt>
4
4
  class Steps
5
5
 
6
- def initialize(step_mother, path_or_io, options)
6
+ def initialize(runtime, path_or_io, options)
7
7
  @io = ensure_io(path_or_io, "steps")
8
8
  @options = options
9
- @step_definition_files = collect_steps(step_mother)
9
+ @step_definition_files = collect_steps(runtime)
10
10
  end
11
11
 
12
12
  def after_features(features)
@@ -19,7 +19,7 @@ module Cucumber
19
19
  count = 0
20
20
  @step_definition_files.keys.sort.each do |step_definition_file|
21
21
  @io.puts step_definition_file
22
-
22
+
23
23
  sources = @step_definition_files[step_definition_file]
24
24
  source_indent = source_indent(sources)
25
25
  sources.sort.each do |file_colon_line, regexp_source|
@@ -33,8 +33,8 @@ module Cucumber
33
33
  @io.puts "#{count} step definition(s) in #{@step_definition_files.size} source file(s)."
34
34
  end
35
35
 
36
- def collect_steps(step_mother)
37
- step_mother.step_definitions.inject({}) do |step_definitions, step_definition|
36
+ def collect_steps(runtime)
37
+ runtime.step_definitions.inject({}) do |step_definitions, step_definition|
38
38
  step_definitions[step_definition.file] ||= []
39
39
  step_definitions[step_definition.file] << [ step_definition.file_colon_line, step_definition.regexp_source ]
40
40
  step_definitions
@@ -46,4 +46,4 @@ module Cucumber
46
46
  end
47
47
  end
48
48
  end
49
- end
49
+ end
@@ -2,14 +2,14 @@ module Cucumber
2
2
  module Formatter
3
3
  module Summary
4
4
 
5
- def scenario_summary(step_mother, &block)
6
- scenarios_proc = lambda{|status| step_mother.scenarios(status)}
7
- dump_count(step_mother.scenarios.length, "scenario") + dump_status_counts(scenarios_proc, &block)
5
+ def scenario_summary(runtime, &block)
6
+ scenarios_proc = lambda{|status| runtime.scenarios(status)}
7
+ dump_count(runtime.scenarios.length, "scenario") + dump_status_counts(scenarios_proc, &block)
8
8
  end
9
9
 
10
- def step_summary(step_mother, &block)
11
- steps_proc = lambda{|status| step_mother.steps(status)}
12
- dump_count(step_mother.steps.length, "step") + dump_status_counts(steps_proc, &block)
10
+ def step_summary(runtime, &block)
11
+ steps_proc = lambda{|status| runtime.steps(status)}
12
+ dump_count(runtime.steps.length, "step") + dump_status_counts(steps_proc, &block)
13
13
  end
14
14
 
15
15
  private
@@ -2,10 +2,10 @@
2
2
  # Tips for improvement - esp. ruby 1.9: http://www.ruby-forum.com/topic/184730
3
3
  require 'cucumber/platform'
4
4
  require 'cucumber/formatter/ansicolor'
5
- $KCODE='u' unless Cucumber::RUBY_1_9
5
+ $KCODE='u' if Cucumber::RUBY_1_8_7
6
6
 
7
7
  if Cucumber::WINDOWS
8
- require 'iconv' unless Cucumber::RUBY_1_9
8
+ require 'iconv' if Cucumber::RUBY_1_8_7
9
9
 
10
10
  if ENV['CUCUMBER_OUTPUT_ENCODING']
11
11
  Cucumber::CODEPAGE = ENV['CUCUMBER_OUTPUT_ENCODING']
@@ -27,14 +27,7 @@ if Cucumber::WINDOWS
27
27
  o.instance_eval do
28
28
  alias cucumber_print print
29
29
  def print(*a)
30
- if Cucumber::RUBY_1_9
31
- begin
32
- cucumber_print(*a.map{|arg| arg.to_s.encode(Encoding.default_external)})
33
- rescue Encoding::UndefinedConversionError => e
34
- STDERR.cucumber_puts("WARNING: #{e.message}")
35
- cucumber_print(*a)
36
- end
37
- else
30
+ if Cucumber::RUBY_1_8_7
38
31
  begin
39
32
  cucumber_print(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a.map{|a|a.to_s}))
40
33
  rescue Iconv::InvalidEncoding => e
@@ -44,19 +37,19 @@ if Cucumber::WINDOWS
44
37
  STDERR.cucumber_puts("WARNING: #{e.message}")
45
38
  cucumber_print(*a)
46
39
  end
40
+ else
41
+ begin
42
+ cucumber_print(*a.map{|arg| arg.to_s.encode(Encoding.default_external)})
43
+ rescue Encoding::UndefinedConversionError => e
44
+ STDERR.cucumber_puts("WARNING: #{e.message}")
45
+ cucumber_print(*a)
46
+ end
47
47
  end
48
48
  end
49
49
 
50
50
  alias cucumber_puts puts
51
51
  def puts(*a)
52
- if Cucumber::RUBY_1_9
53
- begin
54
- cucumber_puts(*a.map{|arg| arg.to_s.encode(Encoding.default_external)})
55
- rescue Encoding::UndefinedConversionError => e
56
- STDERR.cucumber_puts("WARNING: #{e.message}")
57
- cucumber_puts(*a)
58
- end
59
- else
52
+ if Cucumber::RUBY_1_8_7
60
53
  begin
61
54
  cucumber_puts(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a.map{|a|a.to_s}))
62
55
  rescue Iconv::InvalidEncoding => e
@@ -66,6 +59,13 @@ if Cucumber::WINDOWS
66
59
  STDERR.cucumber_puts("WARNING: #{e.message}")
67
60
  cucumber_puts(*a)
68
61
  end
62
+ else
63
+ begin
64
+ cucumber_puts(*a.map{|arg| arg.to_s.encode(Encoding.default_external)})
65
+ rescue Encoding::UndefinedConversionError => e
66
+ STDERR.cucumber_puts("WARNING: #{e.message}")
67
+ cucumber_puts(*a)
68
+ end
69
69
  end
70
70
  end
71
71
  end
@@ -10,8 +10,8 @@ module Cucumber
10
10
  attr_accessor :mean_duration, :status
11
11
  end
12
12
 
13
- def initialize(step_mother, path_or_io, options)
14
- @step_mother = step_mother
13
+ def initialize(runtime, path_or_io, options)
14
+ @runtime = runtime
15
15
  @io = ensure_io(path_or_io, "usage")
16
16
  @options = options
17
17
  @stepdef_to_match = Hash.new{|h,stepdef_key| h[stepdef_key] = []}
@@ -31,9 +31,9 @@ module Cucumber
31
31
  stepdef_key = StepDefKey.new(step_match.step_definition.regexp_source, step_match.step_definition.file_colon_line)
32
32
 
33
33
  @stepdef_to_match[stepdef_key] << {
34
- :keyword => keyword,
35
- :step_match => step_match,
36
- :status => status,
34
+ :keyword => keyword,
35
+ :step_match => step_match,
36
+ :status => status,
37
37
  :file_colon_line => @step.file_colon_line,
38
38
  :duration => @duration
39
39
  }
@@ -117,11 +117,11 @@ module Cucumber
117
117
  end
118
118
 
119
119
  def add_unused_stepdefs
120
- @step_mother.unmatched_step_definitions.each do |step_definition|
120
+ @runtime.unmatched_step_definitions.each do |step_definition|
121
121
  stepdef_key = StepDefKey.new(step_definition.regexp_source, step_definition.file_colon_line)
122
122
  @stepdef_to_match[stepdef_key] = []
123
123
  end
124
124
  end
125
125
  end
126
126
  end
127
- end
127
+ end
@@ -54,4 +54,4 @@ var Transform = CucumberJsDsl.registerTransform;
54
54
 
55
55
  var World = CucumberJsDsl.world;
56
56
 
57
- var steps = CucumberJsDsl.steps;
57
+ var steps = CucumberJsDsl.steps;
@@ -23,7 +23,7 @@ module Cucumber
23
23
  #
24
24
  # Each language implementation manages its own hooks, and must execute them
25
25
  # at appropriate times.
26
- #
26
+ #
27
27
  #
28
28
  module LanguageSupport
29
29
  end
@@ -16,8 +16,8 @@ module Cucumber
16
16
 
17
17
  def feature(feature)
18
18
  @feature = Ast::Feature.new(
19
- nil,
20
- Ast::Comment.new(feature.comments.map{|comment| comment.value}.join("\n")),
19
+ nil,
20
+ Ast::Comment.new(feature.comments.map{|comment| comment.value}.join("\n")),
21
21
  Ast::Tags.new(nil, feature.tags),
22
22
  feature.keyword,
23
23
  feature.name.lstrip,
@@ -30,12 +30,12 @@ module Cucumber
30
30
 
31
31
  def background(background)
32
32
  @background = Ast::Background.new(
33
- Ast::Comment.new(background.comments.map{|comment| comment.value}.join("\n")),
34
- background.line,
35
- background.keyword,
36
- background.name,
33
+ Ast::Comment.new(background.comments.map{|comment| comment.value}.join("\n")),
34
+ background.line,
35
+ background.keyword,
36
+ background.name,
37
37
  background.description,
38
- steps=[]
38
+ []
39
39
  )
40
40
  @feature.background = @background
41
41
  @background.feature = @feature
@@ -45,14 +45,14 @@ module Cucumber
45
45
 
46
46
  def scenario(statement)
47
47
  scenario = Ast::Scenario.new(
48
- @background,
49
- Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")),
50
- Ast::Tags.new(nil, statement.tags),
51
- statement.line,
52
- statement.keyword,
48
+ @background,
49
+ Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")),
50
+ Ast::Tags.new(nil, statement.tags),
51
+ statement.line,
52
+ statement.keyword,
53
53
  statement.name,
54
- statement.description,
55
- steps=[]
54
+ statement.description,
55
+ []
56
56
  )
57
57
  @feature.add_feature_element(scenario)
58
58
  @background.feature_elements << scenario if @background
@@ -62,15 +62,15 @@ module Cucumber
62
62
 
63
63
  def scenario_outline(statement)
64
64
  scenario_outline = Ast::ScenarioOutline.new(
65
- @background,
66
- Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")),
67
- Ast::Tags.new(nil, statement.tags),
68
- statement.line,
69
- statement.keyword,
70
- statement.name,
71
- statement.description,
72
- steps=[],
73
- example_sections=[]
65
+ @background,
66
+ Ast::Comment.new(statement.comments.map{|comment| comment.value}.join("\n")),
67
+ Ast::Tags.new(nil, statement.tags),
68
+ statement.line,
69
+ statement.keyword,
70
+ statement.name,
71
+ statement.description,
72
+ [],
73
+ []
74
74
  )
75
75
  @feature.add_feature_element(scenario_outline)
76
76
  if @background
@@ -83,11 +83,11 @@ module Cucumber
83
83
 
84
84
  def examples(examples)
85
85
  examples_fields = [
86
- Ast::Comment.new(examples.comments.map{|comment| comment.value}.join("\n")),
87
- examples.line,
88
- examples.keyword,
89
- examples.name,
90
- examples.description,
86
+ Ast::Comment.new(examples.comments.map{|comment| comment.value}.join("\n")),
87
+ examples.line,
88
+ examples.keyword,
89
+ examples.name,
90
+ examples.description,
91
91
  matrix(examples.rows)
92
92
  ]
93
93
  @step_container.add_examples(examples_fields, examples)
@@ -95,9 +95,9 @@ module Cucumber
95
95
 
96
96
  def step(gherkin_step)
97
97
  step = Ast::Step.new(
98
- gherkin_step.line,
99
- gherkin_step.keyword,
100
- gherkin_step.name,
98
+ gherkin_step.line,
99
+ gherkin_step.keyword,
100
+ gherkin_step.name,
101
101
  Ast::MultilineArgument.from(gherkin_step.doc_string || gherkin_step.rows)
102
102
  )
103
103
  step.gherkin_statement(gherkin_step)
@@ -110,9 +110,9 @@ module Cucumber
110
110
  def syntax_error(state, event, legal_events, line)
111
111
  # raise "SYNTAX ERROR"
112
112
  end
113
-
113
+
114
114
  private
115
-
115
+
116
116
  def matrix(gherkin_table)
117
117
  gherkin_table.map do |gherkin_row|
118
118
  row = gherkin_row.cells