cucumber 8.0.0 → 9.2.1

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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -23
  3. data/VERSION +1 -0
  4. data/lib/cucumber/cli/main.rb +1 -1
  5. data/lib/cucumber/cli/options.rb +66 -66
  6. data/lib/cucumber/cli/profile_loader.rb +5 -5
  7. data/lib/cucumber/configuration.rb +7 -2
  8. data/lib/cucumber/deprecate.rb +6 -47
  9. data/lib/cucumber/errors.rb +2 -1
  10. data/lib/cucumber/events/envelope.rb +2 -0
  11. data/lib/cucumber/events/gherkin_source_parsed.rb +2 -0
  12. data/lib/cucumber/events/gherkin_source_read.rb +2 -0
  13. data/lib/cucumber/events/test_case_finished.rb +2 -0
  14. data/lib/cucumber/events/test_case_started.rb +2 -0
  15. data/lib/cucumber/events/test_step_finished.rb +2 -0
  16. data/lib/cucumber/events/test_step_started.rb +2 -0
  17. data/lib/cucumber/events/undefined_parameter_type.rb +2 -0
  18. data/lib/cucumber/file_specs.rb +1 -1
  19. data/lib/cucumber/filters/retry.rb +20 -1
  20. data/lib/cucumber/formatter/ansicolor.rb +19 -27
  21. data/lib/cucumber/formatter/ast_lookup.rb +14 -6
  22. data/lib/cucumber/formatter/console.rb +16 -14
  23. data/lib/cucumber/formatter/console_counts.rb +3 -1
  24. data/lib/cucumber/formatter/console_issues.rb +4 -2
  25. data/lib/cucumber/formatter/curl_option_parser.rb +49 -0
  26. data/lib/cucumber/formatter/errors.rb +2 -0
  27. data/lib/cucumber/formatter/fail_fast.rb +1 -1
  28. data/lib/cucumber/formatter/html.rb +2 -0
  29. data/lib/cucumber/formatter/http_io.rb +10 -142
  30. data/lib/cucumber/formatter/io_http_buffer.rb +88 -0
  31. data/lib/cucumber/formatter/json.rb +2 -6
  32. data/lib/cucumber/formatter/junit.rb +4 -4
  33. data/lib/cucumber/formatter/message_builder.rb +21 -6
  34. data/lib/cucumber/formatter/pretty.rb +9 -5
  35. data/lib/cucumber/formatter/publish_banner_printer.rb +0 -2
  36. data/lib/cucumber/formatter/query/hook_by_test_step.rb +2 -0
  37. data/lib/cucumber/formatter/query/pickle_by_test.rb +2 -0
  38. data/lib/cucumber/formatter/query/pickle_step_by_test_step.rb +2 -0
  39. data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +2 -0
  40. data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +2 -0
  41. data/lib/cucumber/formatter/rerun.rb +3 -3
  42. data/lib/cucumber/formatter/unicode.rb +3 -3
  43. data/lib/cucumber/formatter/url_reporter.rb +3 -1
  44. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +23 -25
  45. data/lib/cucumber/glue/invoke_in_world.rb +2 -2
  46. data/lib/cucumber/glue/proto_world.rb +20 -25
  47. data/lib/cucumber/glue/registry_and_more.rb +9 -5
  48. data/lib/cucumber/glue/snippet.rb +4 -2
  49. data/lib/cucumber/glue/world_factory.rb +2 -0
  50. data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +2 -0
  51. data/lib/cucumber/multiline_argument/data_table.rb +37 -36
  52. data/lib/cucumber/platform.rb +11 -16
  53. data/lib/cucumber/rake/task.rb +2 -6
  54. data/lib/cucumber/running_test_case.rb +1 -1
  55. data/lib/cucumber/runtime/for_programming_languages.rb +1 -2
  56. data/lib/cucumber/runtime/meta_message_builder.rb +4 -2
  57. data/lib/cucumber/runtime/user_interface.rb +2 -2
  58. data/lib/cucumber/runtime.rb +5 -5
  59. data/lib/cucumber/step_match.rb +1 -1
  60. data/lib/cucumber/term/ansicolor.rb +1 -1
  61. data/lib/cucumber/term/banner.rb +2 -0
  62. metadata +86 -242
  63. data/CHANGELOG.md +0 -3231
  64. data/CONTRIBUTING.md +0 -246
  65. data/lib/autotest/cucumber.rb +0 -8
  66. data/lib/autotest/cucumber_mixin.rb +0 -133
  67. data/lib/autotest/cucumber_rails.rb +0 -8
  68. data/lib/autotest/cucumber_rails_rspec.rb +0 -8
  69. data/lib/autotest/cucumber_rails_rspec2.rb +0 -8
  70. data/lib/autotest/cucumber_rspec.rb +0 -8
  71. data/lib/autotest/cucumber_rspec2.rb +0 -8
  72. data/lib/autotest/discover.rb +0 -14
  73. data/lib/cucumber/version +0 -1
@@ -1,27 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Detect the platform we're running on so we can tweak behaviour
4
- # in various places.
3
+ # Detect the platform we're running on so we can tweak behaviour in various places.
5
4
  require 'rbconfig'
6
5
  require 'cucumber/core/platform'
7
6
 
8
7
  module Cucumber
9
- unless defined?(Cucumber::VERSION)
10
- VERSION = File.read(File.expand_path('version', __dir__)).strip
11
- BINARY = File.expand_path("#{File.dirname(__FILE__)}/../../bin/cucumber")
12
- LIBDIR = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
13
- RAILS = defined?(Rails)
14
- RUBY_BINARY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
15
- RUBY = defined? RUBY_VERSION
8
+ VERSION = File.read(File.expand_path('../../VERSION', __dir__)).strip
9
+ BINARY = File.expand_path("#{File.dirname(__FILE__)}/../../bin/cucumber")
10
+ LIBDIR = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
11
+ RUBY_BINARY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
16
12
 
17
- class << self
18
- attr_accessor :use_full_backtrace
13
+ class << self
14
+ attr_accessor :use_full_backtrace
19
15
 
20
- # @private
21
- def file_mode(mode, encoding = 'UTF-8')
22
- "#{mode}:#{encoding}"
23
- end
16
+ # @private
17
+ def file_mode(mode, encoding = 'UTF-8')
18
+ "#{mode}:#{encoding}"
24
19
  end
25
- self.use_full_backtrace = false
26
20
  end
21
+ self.use_full_backtrace = false
27
22
  end
@@ -2,11 +2,7 @@
2
2
 
3
3
  require 'cucumber/platform'
4
4
  require 'cucumber/gherkin/formatter/ansi_escapes'
5
- begin
6
- # Support Rake > 0.8.7
7
- require 'rake/dsl_definition'
8
- rescue LoadError
9
- end
5
+ require 'rake/dsl_definition'
10
6
 
11
7
  module Cucumber
12
8
  module Rake
@@ -163,7 +159,7 @@ module Cucumber
163
159
  end
164
160
 
165
161
  def runner(_task_args = nil) # :nodoc:
166
- cucumber_opts = [(ENV['CUCUMBER_OPTS'] ? ENV['CUCUMBER_OPTS'].split(/\s+/) : nil) || cucumber_opts_with_profile]
162
+ cucumber_opts = [ENV['CUCUMBER_OPTS']&.split(/\s+/) || cucumber_opts_with_profile]
167
163
  return ForkedCucumberRunner.new(libs, binary, cucumber_opts, bundler, feature_files) if fork
168
164
 
169
165
  InProcessCucumberRunner.new(libs, cucumber_opts, feature_files)
@@ -50,7 +50,7 @@ module Cucumber
50
50
  end
51
51
 
52
52
  def source_tag_names
53
- tags.map &:name
53
+ tags.map(&:name)
54
54
  end
55
55
 
56
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
 
@@ -1,16 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cucumber/messages'
2
4
  require 'cucumber/ci_environment'
3
5
 
4
6
  module Cucumber
5
7
  class Runtime
6
- # Builder to instanciate a Cucumber::Messages::Meta message filled-in with
8
+ # Builder to instantiate a Cucumber::Messages::Meta message filled-in with
7
9
  # the runtime meta-data:
8
10
  # - protocol version: the version of the Cucumber::Messages protocol
9
11
  # - implementation: the name and version of the implementation (e.g. cucumber-ruby 8.0.0)
10
12
  # - runtime: the name and version of the runtime (e.g. ruby 3.0.1)
11
13
  # - os: the name and version of the operating system (e.g. linux 3.13.0-45-generic)
12
14
  # - cpu: the name of the CPU (e.g. x86_64)
13
- # - ci: informtion about the CI environment if any, including:
15
+ # - ci: information about the CI environment if any, including:
14
16
  # - name: the name of the CI environment (e.g. Jenkins)
15
17
  # - url: the URL of the CI environment (e.g. https://ci.example.com)
16
18
  # - build_number: the build number of the CI environment (e.g. 123)
@@ -41,8 +41,8 @@ module Cucumber
41
41
  # be a path to a file, or if it's an image it may also be a Base64 encoded image.
42
42
  # The embedded data may or may not be ignored, depending on what kind of formatter(s) are active.
43
43
  #
44
- def attach(src, media_type)
45
- @visitor.attach(src, media_type)
44
+ def attach(src, media_type, filename)
45
+ @visitor.attach(src, media_type, filename)
46
46
  end
47
47
 
48
48
  private
@@ -112,9 +112,9 @@ module Cucumber
112
112
 
113
113
  def failure?
114
114
  if @configuration.wip?
115
- summary_report.test_cases.total_passed > 0
115
+ summary_report.test_cases.total_passed.positive?
116
116
  else
117
- !summary_report.ok?(@configuration.strict)
117
+ !summary_report.ok?(strict: @configuration.strict)
118
118
  end
119
119
  end
120
120
 
@@ -150,8 +150,8 @@ module Cucumber
150
150
  end
151
151
 
152
152
  class NormalisedEncodingFile
153
- COMMENT_OR_EMPTY_LINE_PATTERN = /^\s*#|^\s*$/ # :nodoc:
154
- 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:
155
155
 
156
156
  def self.read(path)
157
157
  new(path).read
@@ -235,7 +235,7 @@ module Cucumber
235
235
  end
236
236
 
237
237
  require 'cucumber/core/test/filters'
238
- def filters # rubocop:disable Metrics/AbcSize
238
+ def filters
239
239
  tag_expressions = @configuration.tag_expressions
240
240
  name_regexps = @configuration.name_regexps
241
241
  tag_limits = @configuration.tag_limits
@@ -78,7 +78,7 @@ module Cucumber
78
78
 
79
79
  replacement = if block_given?
80
80
  yield(group.value)
81
- elsif Proc == format.class
81
+ elsif format.instance_of?(Proc)
82
82
  format.call(group.value)
83
83
  else
84
84
  format % group.value
@@ -63,7 +63,7 @@ module Cucumber
63
63
 
64
64
  # Regular expression that is used to scan for ANSI-sequences while
65
65
  # uncoloring strings.
66
- COLORED_REGEXP = /\e\[(?:[34][0-7]|[0-9])?m/
66
+ COLORED_REGEXP = /\e\[(?:[34][0-7]|[0-9])?m/.freeze
67
67
 
68
68
  @coloring = true
69
69
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cucumber/term/ansicolor'
2
4
 
3
5
  module Cucumber