cucumber 4.1.0 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +134 -21
  3. data/VERSION +1 -0
  4. data/lib/cucumber/cli/configuration.rb +27 -2
  5. data/lib/cucumber/cli/main.rb +5 -4
  6. data/lib/cucumber/cli/options.rb +102 -65
  7. data/lib/cucumber/cli/profile_loader.rb +6 -10
  8. data/lib/cucumber/cli/rerun_file.rb +1 -1
  9. data/lib/cucumber/configuration.rb +26 -13
  10. data/lib/cucumber/constantize.rb +1 -1
  11. data/lib/cucumber/deprecate.rb +6 -46
  12. data/lib/cucumber/errors.rb +4 -3
  13. data/lib/cucumber/events/envelope.rb +2 -0
  14. data/lib/cucumber/events/gherkin_source_parsed.rb +2 -0
  15. data/lib/cucumber/events/gherkin_source_read.rb +2 -0
  16. data/lib/cucumber/events/hook_test_step_created.rb +1 -2
  17. data/lib/cucumber/events/step_activated.rb +0 -6
  18. data/lib/cucumber/events/step_definition_registered.rb +0 -5
  19. data/lib/cucumber/events/test_case_created.rb +1 -2
  20. data/lib/cucumber/events/test_case_finished.rb +2 -0
  21. data/lib/cucumber/events/test_case_started.rb +2 -0
  22. data/lib/cucumber/events/test_run_finished.rb +2 -1
  23. data/lib/cucumber/events/test_step_created.rb +1 -2
  24. data/lib/cucumber/events/test_step_finished.rb +2 -0
  25. data/lib/cucumber/events/test_step_started.rb +2 -0
  26. data/lib/cucumber/events/undefined_parameter_type.rb +3 -2
  27. data/lib/cucumber/events.rb +2 -2
  28. data/lib/cucumber/file_specs.rb +2 -1
  29. data/lib/cucumber/filters/activate_steps.rb +1 -0
  30. data/lib/cucumber/filters/retry.rb +20 -1
  31. data/lib/cucumber/filters/tag_limits/verifier.rb +1 -3
  32. data/lib/cucumber/filters/tag_limits.rb +1 -3
  33. data/lib/cucumber/formatter/ansicolor.rb +70 -85
  34. data/lib/cucumber/formatter/ast_lookup.rb +16 -10
  35. data/lib/cucumber/formatter/backtrace_filter.rb +3 -1
  36. data/lib/cucumber/formatter/console.rb +34 -16
  37. data/lib/cucumber/formatter/console_counts.rb +3 -1
  38. data/lib/cucumber/formatter/console_issues.rb +10 -3
  39. data/lib/cucumber/formatter/curl_option_parser.rb +49 -0
  40. data/lib/cucumber/formatter/duration_extractor.rb +1 -0
  41. data/lib/cucumber/formatter/errors.rb +3 -0
  42. data/lib/cucumber/formatter/fail_fast.rb +1 -1
  43. data/lib/cucumber/formatter/fanout.rb +1 -1
  44. data/lib/cucumber/formatter/html.rb +3 -1
  45. data/lib/cucumber/formatter/http_io.rb +10 -136
  46. data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -1
  47. data/lib/cucumber/formatter/interceptor.rb +4 -3
  48. data/lib/cucumber/formatter/io.rb +50 -12
  49. data/lib/cucumber/formatter/io_http_buffer.rb +88 -0
  50. data/lib/cucumber/formatter/json.rb +36 -37
  51. data/lib/cucumber/formatter/junit.rb +29 -9
  52. data/lib/cucumber/formatter/message.rb +3 -2
  53. data/lib/cucumber/formatter/message_builder.rb +32 -16
  54. data/lib/cucumber/formatter/pretty.rb +44 -29
  55. data/lib/cucumber/formatter/progress.rb +2 -1
  56. data/lib/cucumber/formatter/publish_banner_printer.rb +75 -0
  57. data/lib/cucumber/formatter/query/hook_by_test_step.rb +3 -0
  58. data/lib/cucumber/formatter/query/pickle_by_test.rb +2 -0
  59. data/lib/cucumber/formatter/query/pickle_step_by_test_step.rb +2 -0
  60. data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +2 -0
  61. data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +4 -0
  62. data/lib/cucumber/formatter/rerun.rb +7 -5
  63. data/lib/cucumber/formatter/steps.rb +6 -3
  64. data/lib/cucumber/formatter/summary.rb +2 -1
  65. data/lib/cucumber/formatter/unicode.rb +7 -7
  66. data/lib/cucumber/formatter/url_reporter.rb +19 -0
  67. data/lib/cucumber/formatter/usage.rb +9 -7
  68. data/lib/cucumber/gherkin/data_table_parser.rb +2 -1
  69. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +25 -27
  70. data/lib/cucumber/gherkin/steps_parser.rb +1 -1
  71. data/lib/cucumber/glue/dsl.rb +30 -16
  72. data/lib/cucumber/glue/hook.rb +6 -3
  73. data/lib/cucumber/glue/invoke_in_world.rb +5 -5
  74. data/lib/cucumber/glue/proto_world.rb +37 -57
  75. data/lib/cucumber/glue/registry_and_more.rb +31 -12
  76. data/lib/cucumber/glue/registry_wrapper.rb +31 -0
  77. data/lib/cucumber/glue/snippet.rb +4 -2
  78. data/lib/cucumber/glue/step_definition.rb +9 -7
  79. data/lib/cucumber/glue/world_factory.rb +2 -0
  80. data/lib/cucumber/hooks.rb +1 -0
  81. data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +5 -2
  82. data/lib/cucumber/multiline_argument/data_table.rb +65 -79
  83. data/lib/cucumber/platform.rb +11 -16
  84. data/lib/cucumber/rake/task.rb +22 -17
  85. data/lib/cucumber/rspec/disable_option_parser.rb +6 -3
  86. data/lib/cucumber/rspec/doubles.rb +3 -5
  87. data/lib/cucumber/running_test_case.rb +2 -1
  88. data/lib/cucumber/runtime/for_programming_languages.rb +1 -2
  89. data/lib/cucumber/runtime/meta_message_builder.rb +108 -0
  90. data/lib/cucumber/runtime/support_code.rb +3 -0
  91. data/lib/cucumber/runtime/user_interface.rb +7 -6
  92. data/lib/cucumber/runtime.rb +50 -24
  93. data/lib/cucumber/step_match.rb +7 -11
  94. data/lib/cucumber/step_match_search.rb +3 -2
  95. data/lib/cucumber/term/ansicolor.rb +74 -50
  96. data/lib/cucumber/term/banner.rb +59 -0
  97. data/lib/cucumber.rb +2 -1
  98. data/lib/simplecov_setup.rb +1 -1
  99. metadata +103 -229
  100. data/CHANGELOG.md +0 -2682
  101. data/CONTRIBUTING.md +0 -71
  102. data/lib/autotest/cucumber.rb +0 -8
  103. data/lib/autotest/cucumber_mixin.rb +0 -132
  104. data/lib/autotest/cucumber_rails.rb +0 -8
  105. data/lib/autotest/cucumber_rails_rspec.rb +0 -8
  106. data/lib/autotest/cucumber_rails_rspec2.rb +0 -8
  107. data/lib/autotest/cucumber_rspec.rb +0 -8
  108. data/lib/autotest/cucumber_rspec2.rb +0 -8
  109. data/lib/autotest/discover.rb +0 -13
  110. data/lib/cucumber/core_ext/string.rb +0 -11
  111. data/lib/cucumber/version +0 -1
@@ -2,12 +2,12 @@
2
2
 
3
3
  require 'optparse'
4
4
 
5
- module Spec #:nodoc:
6
- module Runner #:nodoc:
5
+ module Spec # :nodoc:
6
+ module Runner # :nodoc:
7
7
  # Neuters RSpec's option parser.
8
8
  # (RSpec's option parser tries to parse ARGV, which
9
9
  # will fail when running cucumber)
10
- class OptionParser < ::OptionParser #:nodoc:
10
+ class OptionParser < ::OptionParser # :nodoc:
11
11
  NEUTERED_RSPEC = Object.new
12
12
  def NEUTERED_RSPEC.method_missing(_method, *_args) # rubocop:disable Style/MissingRespondToMissing
13
13
  self || super
@@ -15,11 +15,14 @@ module Spec #:nodoc:
15
15
 
16
16
  def self.method_added(method)
17
17
  return if @__neutering_rspec
18
+
18
19
  @__neutering_rspec = true
19
20
  define_method(method) do |*_a|
20
21
  NEUTERED_RSPEC
21
22
  end
22
23
  @__neutering_rspec = false
24
+
25
+ super
23
26
  end
24
27
  end
25
28
  end
@@ -13,9 +13,7 @@ Before do
13
13
  end
14
14
 
15
15
  After do
16
- begin
17
- RSpec::Mocks.verify
18
- ensure
19
- RSpec::Mocks.teardown
20
- end
16
+ RSpec::Mocks.verify
17
+ ensure
18
+ RSpec::Mocks.teardown
21
19
  end
@@ -33,6 +33,7 @@ module Cucumber
33
33
 
34
34
  def exception
35
35
  return unless @result.failed?
36
+
36
37
  @result.exception
37
38
  end
38
39
 
@@ -49,7 +50,7 @@ module Cucumber
49
50
  end
50
51
 
51
52
  def source_tag_names
52
- tags.map &:name
53
+ tags.map(&:name)
53
54
  end
54
55
 
55
56
  def with_result(result)
@@ -7,8 +7,7 @@ module Cucumber
7
7
  class Runtime
8
8
  # This is what a programming language will consider to be a runtime.
9
9
  #
10
- # It's a thin class that directs the handul of methods needed by the
11
- # programming languages to the right place.
10
+ # It's a thin class that directs the handful of methods needed by the programming languages to the right place
12
11
  class ForProgrammingLanguages
13
12
  extend Forwardable
14
13
 
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/messages'
4
+ require 'cucumber/ci_environment'
5
+
6
+ module Cucumber
7
+ class Runtime
8
+ # Builder to instantiate a Cucumber::Messages::Meta message filled-in with
9
+ # the runtime meta-data:
10
+ # - protocol version: the version of the Cucumber::Messages protocol
11
+ # - implementation: the name and version of the implementation (e.g. cucumber-ruby 8.0.0)
12
+ # - runtime: the name and version of the runtime (e.g. ruby 3.0.1)
13
+ # - os: the name and version of the operating system (e.g. linux 3.13.0-45-generic)
14
+ # - cpu: the name of the CPU (e.g. x86_64)
15
+ # - ci: information about the CI environment if any, including:
16
+ # - name: the name of the CI environment (e.g. Jenkins)
17
+ # - url: the URL of the CI environment (e.g. https://ci.example.com)
18
+ # - build_number: the build number of the CI environment (e.g. 123)
19
+ # - git: the git information of the CI environment if any
20
+ # - remote: the remote of the git repository (e.g. git@github.com:cucumber/cucumber-ruby.git)
21
+ # - revision: the revision of the git repository (e.g. abcdef)
22
+ # - branch: the name of the git branch (e.g. main)
23
+ # - tag: the name of the git tag (e.g. v1.0.0)
24
+ class MetaMessageBuilder
25
+ class << self
26
+ # Builds a Cucumber::Messages::Meta filled-in with the runtime meta-data
27
+ #
28
+ # @param [env] environment data from which the CI information will be
29
+ # retrieved (default ENV). Can be used to mock the environment for
30
+ # testing purpose.
31
+ #
32
+ # @return [Cucumber::Messages::Meta] the meta message
33
+ #
34
+ # @see Cucumber::Runtime::MetaMessageBuilder
35
+ #
36
+ # @example
37
+ # Cucumber::Runtime::MetaMessageBuilder.build_meta_message
38
+ #
39
+ def build_meta_message(env = ENV)
40
+ Cucumber::Messages::Meta.new(
41
+ protocol_version: protocol_version,
42
+ implementation: implementation,
43
+ runtime: runtime,
44
+ os: os,
45
+ cpu: cpu,
46
+ ci: ci(env)
47
+ )
48
+ end
49
+
50
+ private
51
+
52
+ def protocol_version
53
+ Cucumber::Messages::VERSION
54
+ end
55
+
56
+ def implementation
57
+ Cucumber::Messages::Product.new(
58
+ name: 'cucumber-ruby',
59
+ version: Cucumber::VERSION
60
+ )
61
+ end
62
+
63
+ def runtime
64
+ Cucumber::Messages::Product.new(
65
+ name: RUBY_ENGINE,
66
+ version: RUBY_VERSION
67
+ )
68
+ end
69
+
70
+ def os
71
+ Cucumber::Messages::Product.new(
72
+ name: RbConfig::CONFIG['target_os'],
73
+ version: Sys::Uname.uname.version
74
+ )
75
+ end
76
+
77
+ def cpu
78
+ Cucumber::Messages::Product.new(
79
+ name: RbConfig::CONFIG['target_cpu']
80
+ )
81
+ end
82
+
83
+ def ci(env)
84
+ ci_data = Cucumber::CiEnvironment.detect_ci_environment(env)
85
+ return nil unless ci_data
86
+
87
+ Cucumber::Messages::Ci.new(
88
+ name: ci_data[:name],
89
+ url: ci_data[:url],
90
+ build_number: ci_data[:buildNumber],
91
+ git: git_info(ci_data)
92
+ )
93
+ end
94
+
95
+ def git_info(ci_data)
96
+ return nil unless ci_data[:git]
97
+
98
+ Cucumber::Messages::Git.new(
99
+ remote: ci_data[:git][:remote],
100
+ revision: ci_data[:git][:revision],
101
+ branch: ci_data[:git][:branch],
102
+ tag: ci_data[:git][:tag]
103
+ )
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -72,6 +72,7 @@ module Cucumber
72
72
  def invoke_dynamic_step(step_name, multiline_argument, _location = nil)
73
73
  matches = step_matches(step_name)
74
74
  raise UndefinedDynamicStep, step_name if matches.empty?
75
+
75
76
  matches.first.invoke(multiline_argument)
76
77
  end
77
78
 
@@ -109,6 +110,7 @@ module Cucumber
109
110
 
110
111
  def apply_before_hooks(test_case)
111
112
  return test_case if test_case.test_steps.empty?
113
+
112
114
  scenario = RunningTestCase.new(test_case)
113
115
  hooks = registry.hooks_for(:before, scenario)
114
116
  BeforeHooks.new(@configuration.id_generator, hooks, scenario, @configuration.event_bus).apply_to(test_case)
@@ -116,6 +118,7 @@ module Cucumber
116
118
 
117
119
  def apply_after_hooks(test_case)
118
120
  return test_case if test_case.test_steps.empty?
121
+
119
122
  scenario = RunningTestCase.new(test_case)
120
123
  hooks = registry.hooks_for(:after, scenario)
121
124
  AfterHooks.new(@configuration.id_generator, hooks, scenario, @configuration.event_bus).apply_to(test_case)
@@ -21,8 +21,8 @@ module Cucumber
21
21
  # that makes a sound before invoking #ask.
22
22
  #
23
23
  def ask(question, timeout_seconds)
24
- STDOUT.puts(question)
25
- STDOUT.flush
24
+ $stdout.puts(question)
25
+ $stdout.flush
26
26
  puts(question)
27
27
 
28
28
  answer = if Cucumber::JRUBY
@@ -32,6 +32,7 @@ module Cucumber
32
32
  end
33
33
 
34
34
  raise("Waited for input for #{timeout_seconds} seconds, then timed out.") unless answer
35
+
35
36
  puts(answer)
36
37
  answer
37
38
  end
@@ -40,15 +41,15 @@ module Cucumber
40
41
  # be a path to a file, or if it's an image it may also be a Base64 encoded image.
41
42
  # The embedded data may or may not be ignored, depending on what kind of formatter(s) are active.
42
43
  #
43
- def attach(src, media_type)
44
- @visitor.attach(src, media_type)
44
+ def attach(src, media_type, filename)
45
+ @visitor.attach(src, media_type, filename)
45
46
  end
46
47
 
47
48
  private
48
49
 
49
50
  def mri_gets(timeout_seconds)
50
51
  Timeout.timeout(timeout_seconds) do
51
- STDIN.gets
52
+ $stdin.gets
52
53
  end
53
54
  rescue Timeout::Error
54
55
  nil
@@ -57,7 +58,7 @@ module Cucumber
57
58
  def jruby_gets(timeout_seconds)
58
59
  answer = nil
59
60
  t = java.lang.Thread.new do
60
- answer = STDIN.gets
61
+ answer = $stdin.gets
61
62
  end
62
63
  t.start
63
64
  t.join(timeout_seconds * 1000)
@@ -2,15 +2,17 @@
2
2
 
3
3
  require 'fileutils'
4
4
  require 'cucumber/configuration'
5
- require 'cucumber/create_meta'
5
+ require 'cucumber/deprecate'
6
6
  require 'cucumber/load_path'
7
7
  require 'cucumber/formatter/duration'
8
8
  require 'cucumber/file_specs'
9
9
  require 'cucumber/filters'
10
10
  require 'cucumber/formatter/fanout'
11
11
  require 'cucumber/gherkin/i18n'
12
+ require 'cucumber/glue/registry_wrapper'
12
13
  require 'cucumber/step_match_search'
13
14
  require 'cucumber/messages'
15
+ require 'cucumber/runtime/meta_message_builder'
14
16
  require 'sys/uname'
15
17
 
16
18
  module Cucumber
@@ -24,8 +26,8 @@ module Cucumber
24
26
  attr_reader :path
25
27
 
26
28
  def initialize(original_exception, path)
27
- super(original_exception)
28
29
  @path = path
30
+ super(original_exception)
29
31
  end
30
32
  end
31
33
 
@@ -35,6 +37,7 @@ module Cucumber
35
37
  class FeatureFolderNotFoundException < RuntimeError
36
38
  def initialize(path)
37
39
  @path = path
40
+ super
38
41
  end
39
42
 
40
43
  def message
@@ -63,21 +66,22 @@ module Cucumber
63
66
  @support_code.configure(@configuration)
64
67
  end
65
68
 
66
- require 'cucumber/wire/plugin'
67
69
  def run!
68
70
  @configuration.notify :envelope, Cucumber::Messages::Envelope.new(
69
- meta: Cucumber::CreateMeta.create_meta('cucumber-ruby', Cucumber::VERSION)
71
+ meta: MetaMessageBuilder.build_meta_message
70
72
  )
71
73
 
72
74
  load_step_definitions
73
- install_wire_plugin
74
- fire_after_configuration_hook
75
+ fire_install_plugin_hook
76
+ fire_before_all_hook unless dry_run?
75
77
  # TODO: can we remove this state?
76
78
  self.visitor = report
77
79
 
78
80
  receiver = Test::Runner.new(@configuration.event_bus)
79
81
  compile features, receiver, filters, @configuration.event_bus
80
- @configuration.notify :test_run_finished
82
+ @configuration.notify :test_run_finished, !failure?
83
+
84
+ fire_after_all_hook unless dry_run?
81
85
  end
82
86
 
83
87
  def features_paths
@@ -106,10 +110,26 @@ module Cucumber
106
110
  Core::Test::DocString.new(string_without_triple_quotes, content_type)
107
111
  end
108
112
 
113
+ def failure?
114
+ if @configuration.wip?
115
+ summary_report.test_cases.total_passed.positive?
116
+ else
117
+ !summary_report.ok?(strict: @configuration.strict)
118
+ end
119
+ end
120
+
109
121
  private
110
122
 
111
- def fire_after_configuration_hook #:nodoc:
112
- @support_code.fire_hook(:after_configuration, @configuration)
123
+ def fire_install_plugin_hook # :nodoc:
124
+ @support_code.fire_hook(:install_plugin, @configuration, registry_wrapper)
125
+ end
126
+
127
+ def fire_before_all_hook # :nodoc:
128
+ @support_code.fire_hook(:before_all)
129
+ end
130
+
131
+ def fire_after_all_hook # :nodoc:
132
+ @support_code.fire_hook(:after_all)
113
133
  end
114
134
 
115
135
  require 'cucumber/core/gherkin/document'
@@ -130,8 +150,8 @@ module Cucumber
130
150
  end
131
151
 
132
152
  class NormalisedEncodingFile
133
- COMMENT_OR_EMPTY_LINE_PATTERN = /^\s*#|^\s*$/ #:nodoc:
134
- ENCODING_PATTERN = /^\s*#\s*encoding\s*:\s*([^\s]+)/ #:nodoc:
153
+ COMMENT_OR_EMPTY_LINE_PATTERN = /^\s*#|^\s*$/.freeze # :nodoc:
154
+ ENCODING_PATTERN = /^\s*#\s*encoding\s*:\s*([^\s]+)/.freeze # :nodoc:
135
155
 
136
156
  def self.read(path)
137
157
  new(path).read
@@ -166,11 +186,15 @@ module Cucumber
166
186
 
167
187
  require 'cucumber/formatter/ignore_missing_messages'
168
188
  require 'cucumber/formatter/fail_fast'
189
+ require 'cucumber/formatter/publish_banner_printer'
169
190
  require 'cucumber/core/report/summary'
191
+
170
192
  def report
171
193
  return @report if @report
194
+
172
195
  reports = [summary_report] + formatters
173
196
  reports << fail_fast_report if @configuration.fail_fast?
197
+ reports << publish_banner_printer unless @configuration.publish_quiet?
174
198
  @report ||= Formatter::Fanout.new(reports)
175
199
  end
176
200
 
@@ -182,6 +206,10 @@ module Cucumber
182
206
  @fail_fast_report ||= Formatter::FailFast.new(@configuration)
183
207
  end
184
208
 
209
+ def publish_banner_printer
210
+ @publish_banner_printer ||= Formatter::PublishBannerPrinter.new(@configuration)
211
+ end
212
+
185
213
  def formatters
186
214
  @formatters ||=
187
215
  @configuration.formatter_factories do |factory, formatter_options, path_or_io|
@@ -192,10 +220,12 @@ module Cucumber
192
220
  def create_formatter(factory, formatter_options, path_or_io)
193
221
  if accept_options?(factory)
194
222
  return factory.new(@configuration, formatter_options) if path_or_io.nil?
223
+
195
224
  factory.new(@configuration.with_options(out_stream: path_or_io),
196
225
  formatter_options)
197
226
  else
198
227
  return factory.new(@configuration) if path_or_io.nil?
228
+
199
229
  factory.new(@configuration.with_options(out_stream: path_or_io))
200
230
  end
201
231
  end
@@ -204,17 +234,8 @@ module Cucumber
204
234
  factory.instance_method(:initialize).arity > 1
205
235
  end
206
236
 
207
- def failure?
208
- if @configuration.wip?
209
- summary_report.test_cases.total_passed > 0
210
- else
211
- !summary_report.ok?(@configuration.strict)
212
- end
213
- end
214
- public :failure?
215
-
216
237
  require 'cucumber/core/test/filters'
217
- def filters # rubocop:disable Metrics/AbcSize
238
+ def filters
218
239
  tag_expressions = @configuration.tag_expressions
219
240
  name_regexps = @configuration.name_regexps
220
241
  tag_limits = @configuration.tag_limits
@@ -228,12 +249,17 @@ module Cucumber
228
249
  step_match_search = StepMatchSearch.new(@support_code.registry.method(:step_matches), @configuration)
229
250
  filters << Filters::ActivateSteps.new(step_match_search, @configuration)
230
251
  @configuration.filters.each { |filter| filters << filter }
252
+
231
253
  unless configuration.dry_run?
232
254
  filters << Filters::ApplyAfterStepHooks.new(@support_code)
233
255
  filters << Filters::ApplyBeforeHooks.new(@support_code)
234
256
  filters << Filters::ApplyAfterHooks.new(@support_code)
235
257
  filters << Filters::ApplyAroundHooks.new(@support_code)
236
- filters << Filters::BroadcastTestCaseReadyEvent.new(@configuration)
258
+ end
259
+
260
+ filters << Filters::BroadcastTestCaseReadyEvent.new(@configuration)
261
+
262
+ unless configuration.dry_run?
237
263
  filters << Filters::BroadcastTestRunStartedEvent.new(@configuration)
238
264
  filters << Filters::Quit.new
239
265
  filters << Filters::Retry.new(@configuration)
@@ -248,8 +274,8 @@ module Cucumber
248
274
  @support_code.load_files!(files)
249
275
  end
250
276
 
251
- def install_wire_plugin
252
- Cucumber::Wire::Plugin.new(@configuration, @support_code.registry).install if @configuration.all_files_to_load.any? { |f| f =~ /\.wire$/ }
277
+ def registry_wrapper
278
+ Cucumber::Glue::RegistryWrapper.new(@support_code.registry)
253
279
  end
254
280
 
255
281
  def log
@@ -4,11 +4,12 @@ require 'cucumber/multiline_argument'
4
4
 
5
5
  module Cucumber
6
6
  # Represents the match found between a Test Step and its activation
7
- class StepMatch #:nodoc:
7
+ class StepMatch # :nodoc:
8
8
  attr_reader :step_definition, :step_arguments
9
9
 
10
10
  def initialize(step_definition, step_name, step_arguments)
11
11
  raise "step_arguments can't be nil (but it can be an empty array)" if step_arguments.nil?
12
+
12
13
  @step_definition = step_definition
13
14
  @name_to_match = step_name
14
15
  @step_arguments = step_arguments
@@ -28,7 +29,7 @@ module Cucumber
28
29
  end
29
30
 
30
31
  def invoke(multiline_arg)
31
- all_args = deep_clone_args
32
+ all_args = args
32
33
  multiline_arg.append_to(all_args)
33
34
  @step_definition.invoke(all_args)
34
35
  end
@@ -77,7 +78,7 @@ module Cucumber
77
78
 
78
79
  replacement = if block_given?
79
80
  yield(group.value)
80
- elsif Proc == format.class
81
+ elsif format.instance_of?(Proc)
81
82
  format.call(group.value)
82
83
  else
83
84
  format % group.value
@@ -90,15 +91,9 @@ module Cucumber
90
91
  s
91
92
  end
92
93
 
93
- def inspect #:nodoc:
94
+ def inspect # :nodoc:
94
95
  "#<#{self.class}: #{location}>"
95
96
  end
96
-
97
- private
98
-
99
- def deep_clone_args
100
- Marshal.load(Marshal.dump(args))
101
- end
102
97
  end
103
98
 
104
99
  class SkippingStepMatch
@@ -107,7 +102,7 @@ module Cucumber
107
102
  end
108
103
  end
109
104
 
110
- class NoStepMatch #:nodoc:
105
+ class NoStepMatch # :nodoc:
111
106
  attr_reader :step_definition, :name
112
107
 
113
108
  def initialize(step, name)
@@ -121,6 +116,7 @@ module Cucumber
121
116
 
122
117
  def location
123
118
  raise "No location for #{@step}" unless @step.location
119
+
124
120
  @step.location
125
121
  end
126
122
 
@@ -20,6 +20,7 @@ module Cucumber
20
20
  def call(step_name)
21
21
  result = @search.call(step_name)
22
22
  raise Cucumber::Ambiguous.new(step_name, result, @configuration.guess?) if result.length > 1
23
+
23
24
  result
24
25
  end
25
26
  end
@@ -35,7 +36,7 @@ module Cucumber
35
36
 
36
37
  private
37
38
 
38
- def best_matches(_step_name, step_matches) #:nodoc:
39
+ def best_matches(_step_name, step_matches) # :nodoc:
39
40
  no_groups = step_matches.select { |step_match| step_match.args.empty? }
40
41
  max_arg_length = step_matches.map { |step_match| step_match.args.length }.max
41
42
  top_groups = step_matches.select { |step_match| step_match.args.length == max_arg_length }
@@ -54,7 +55,7 @@ module Cucumber
54
55
 
55
56
  require 'delegate'
56
57
  class CachesStepMatch < SimpleDelegator
57
- def call(step_name) #:nodoc:
58
+ def call(step_name) # :nodoc:
58
59
  @match_cache ||= {}
59
60
 
60
61
  matches = @match_cache[step_name]