cucumber 9.1.1 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81294b0304068bde0d87c31fc0d58451d79a59c73bc743bf4ea282dcf5c2ba2c
4
- data.tar.gz: 9f8e3297cfd2fdf1f977a1e748abf2a2cd08f742709884042d56213ab4ff6499
3
+ metadata.gz: 1c84d3e0ab90cabd1d67121371c8a95c0e5f91bfa5f3ec42a1024c1a85130bde
4
+ data.tar.gz: 1386d49afc93d04c9b616f38ab4466c8aa3092aa60a293c82557465ad8b4538a
5
5
  SHA512:
6
- metadata.gz: 380511f8909d71467d326c13510820ed9e16517c4aaf68e3bcc6bf14a9a7e9588060e04238e970a1e4d37ed8dd4b725347c4153dd12357dae2c7ffcf548e6949
7
- data.tar.gz: 3ee41bcacdfb4b040cd5cab60c3c94c5a7fcb533b06fc73d2a58e49aa12652b0e834298931425e537ef15b51f528a4469c833044dc577e277374175a9fbdbacc
6
+ metadata.gz: afd28a66515dbb07168f7c906d1de7feb5c780437a22b0492f218db943555bc996e7dfc77750257033c9ae8c843e350ca12c389963b78e6ddf1c58dc3f1df371
7
+ data.tar.gz: bd21e8e340afc215e887be2e353fd9060a4a4ccf1975298403ed6487e263b4103ef01a73e069f16758cc286ba6d507ae0e2f4b9d72916fb976cbbe440af9d154
data/VERSION CHANGED
@@ -1 +1 @@
1
- 9.1.1
1
+ 9.2.0
@@ -12,26 +12,26 @@ module Cucumber
12
12
  CUCUMBER_PUBLISH_URL = ENV['CUCUMBER_PUBLISH_URL'] || 'https://messages.cucumber.io/api/reports -X GET'
13
13
  INDENT = ' ' * 53
14
14
  BUILTIN_FORMATS = {
15
- 'pretty' => ['Cucumber::Formatter::Pretty', 'Prints the feature as is - in colours.'],
16
- 'progress' => ['Cucumber::Formatter::Progress', 'Prints one character per scenario.'],
17
- 'rerun' => ['Cucumber::Formatter::Rerun', 'Prints failing files with line numbers.'],
18
- 'usage' => ['Cucumber::Formatter::Usage', "Prints where step definitions are used.\n" \
19
- "#{INDENT}The slowest step definitions (with duration) are\n" \
20
- "#{INDENT}listed first. If --dry-run is used the duration\n" \
21
- "#{INDENT}is not shown, and step definitions are sorted by\n" \
22
- "#{INDENT}filename instead."],
23
- 'stepdefs' => ['Cucumber::Formatter::Stepdefs', "Prints All step definitions with their locations. Same as\n" \
24
- "#{INDENT}the usage formatter, except that steps are not printed."],
25
- 'junit' => ['Cucumber::Formatter::Junit', "Generates a report similar to Ant+JUnit. Use\n" \
26
- "#{INDENT}junit,fileattribute=true to include a file attribute."],
27
- 'json' => ['Cucumber::Formatter::Json', "Prints the feature as JSON.\n" \
28
- "#{INDENT}The JSON format is in maintenance mode.\n" \
29
- "#{INDENT}Please consider using the message formatter\n"\
30
- "#{INDENT}with the standalone json-formatter\n" \
31
- "#{INDENT}(https://github.com/cucumber/cucumber/tree/master/json-formatter)."],
32
- 'message' => ['Cucumber::Formatter::Message', 'Prints each message in NDJSON form, which can then be consumed by other tools.'],
33
- 'html' => ['Cucumber::Formatter::HTML', 'Outputs HTML report'],
34
- 'summary' => ['Cucumber::Formatter::Summary', 'Summary output of feature and scenarios']
15
+ 'pretty' => ['Cucumber::Formatter::Pretty', 'Prints the feature as is - in colours.'],
16
+ 'progress' => ['Cucumber::Formatter::Progress', 'Prints one character per scenario.'],
17
+ 'rerun' => ['Cucumber::Formatter::Rerun', 'Prints failing files with line numbers.'],
18
+ 'usage' => ['Cucumber::Formatter::Usage', "Prints where step definitions are used.\n" \
19
+ "#{INDENT}The slowest step definitions (with duration) are\n" \
20
+ "#{INDENT}listed first. If --dry-run is used the duration\n" \
21
+ "#{INDENT}is not shown, and step definitions are sorted by\n" \
22
+ "#{INDENT}filename instead."],
23
+ 'stepdefs' => ['Cucumber::Formatter::Stepdefs', "Prints All step definitions with their locations. Same as\n" \
24
+ "#{INDENT}the usage formatter, except that steps are not printed."],
25
+ 'junit' => ['Cucumber::Formatter::Junit', "Generates a report similar to Ant+JUnit. Use\n" \
26
+ "#{INDENT}junit,fileattribute=true to include a file attribute."],
27
+ 'json' => ['Cucumber::Formatter::Json', "Prints the feature as JSON.\n" \
28
+ "#{INDENT}The JSON format is in maintenance mode.\n" \
29
+ "#{INDENT}Please consider using the message formatter\n"\
30
+ "#{INDENT}with the standalone json-formatter\n" \
31
+ "#{INDENT}(https://github.com/cucumber/cucumber/tree/master/json-formatter)."],
32
+ 'message' => ['Cucumber::Formatter::Message', 'Prints each message in NDJSON form, which can then be consumed by other tools.'],
33
+ 'html' => ['Cucumber::Formatter::HTML', 'Outputs HTML report'],
34
+ 'summary' => ['Cucumber::Formatter::Summary', 'Summary output of feature and scenarios']
35
35
  }.freeze
36
36
  max = BUILTIN_FORMATS.keys.map(&:length).max
37
37
  FORMAT_HELP_MSG = [
@@ -116,10 +116,10 @@ module Cucumber
116
116
  opts.on('-f FORMAT', '--format FORMAT', *format_msg, *FORMAT_HELP) do |v|
117
117
  add_option :formats, [*parse_formats(v), @out_stream]
118
118
  end
119
- opts.on('--init', *init_msg) { |_v| initialize_project }
119
+ opts.on('--init', *init_msg) { initialize_project }
120
120
  opts.on('-o', '--out [FILE|DIR|URL]', *out_msg) { |v| out_stream v }
121
- opts.on('-t TAG_EXPRESSION', '--tags TAG_EXPRESSION', *tags_msg) { |v| add_tag v }
122
- opts.on('-n NAME', '--name NAME', *name_msg) { |v| add_option :name_regexps, /#{v}/ }
121
+ opts.on('-t TAG_EXPRESSION', '--tags TAG_EXPRESSION', *tags_msg) { |v| add_tag(v) }
122
+ opts.on('-n NAME', '--name NAME', *name_msg) { |v| add_option(:name_regexps, /#{v}/) }
123
123
  opts.on('-e', '--exclude PATTERN', *exclude_msg) { |v| add_option :excludes, Regexp.new(v) }
124
124
  opts.on(PROFILE_SHORT_FLAG, "#{PROFILE_LONG_FLAG} PROFILE", *profile_short_flag_msg) { |v| add_profile v }
125
125
  opts.on(NO_PROFILE_SHORT_FLAG, NO_PROFILE_LONG_FLAG, *no_profile_short_flag_msg) { |_v| disable_profile_loading }
@@ -295,15 +295,15 @@ module Cucumber
295
295
  ]
296
296
  end
297
297
 
298
- def parse_formats(v)
299
- formatter, *formatter_options = v.split(',')
300
- options_hash = Hash[formatter_options.map { |s| s.split('=') }]
298
+ def parse_formats(value)
299
+ formatter, *formatter_options = value.split(',')
300
+ options_hash = Hash[formatter_options.map { |string| string.split('=') }]
301
301
  [formatter, options_hash]
302
302
  end
303
303
 
304
- def out_stream(v)
304
+ def out_stream(value)
305
305
  @options[:formats] << ['pretty', {}, nil] if @options[:formats].empty?
306
- @options[:formats][-1][2] = v
306
+ @options[:formats][-1][2] = value
307
307
  end
308
308
 
309
309
  def tags_msg
@@ -375,12 +375,12 @@ module Cucumber
375
375
  ].join("\n")
376
376
  end
377
377
 
378
- def require_files(v)
379
- @options[:require] << v
380
- return unless Cucumber::JRUBY && File.directory?(v)
378
+ def require_files(filenames)
379
+ @options[:require] << filenames
380
+ return unless Cucumber::JRUBY && File.directory?(filenames)
381
381
 
382
382
  require 'java'
383
- $CLASSPATH << v
383
+ $CLASSPATH << filenames
384
384
  end
385
385
 
386
386
  def require_jars(jars)
@@ -441,8 +441,8 @@ module Cucumber
441
441
  ProjectInitializer.new.run && Kernel.exit(0)
442
442
  end
443
443
 
444
- def add_profile(p)
445
- @profiles << p
444
+ def add_profile(profile)
445
+ @profiles << profile
446
446
  end
447
447
 
448
448
  def set_option(option, value = nil)
@@ -455,7 +455,7 @@ module Cucumber
455
455
  end
456
456
 
457
457
  def exit_ok(text)
458
- @out_stream.puts text
458
+ @out_stream.puts(text)
459
459
  Kernel.exit(0)
460
460
  end
461
461
 
@@ -483,22 +483,11 @@ module Cucumber
483
483
  end
484
484
  end
485
485
 
486
- def disable_profile_loading?
487
- @disable_profile_loading
488
- end
489
-
490
486
  def merge_profiles
491
- if @disable_profile_loading
492
- @out_stream.puts 'Disabling profiles...'
493
- return
494
- end
487
+ return @out_stream.puts 'Disabling profiles...' if @disable_profile_loading
495
488
 
496
489
  @profiles << @default_profile if default_profile_should_be_used?
497
-
498
- @profiles.each do |profile|
499
- merge_with_profile(profile)
500
- end
501
-
490
+ @profiles.each { |profile| merge_with_profile(profile) }
502
491
  @options[:profiles] = @profiles
503
492
  end
504
493
 
@@ -63,7 +63,6 @@ module Cucumber
63
63
  module ANSIColor
64
64
  include Cucumber::Term::ANSIColor
65
65
 
66
- # :stopdoc:
67
66
  ALIASES = Hash.new do |h, k|
68
67
  next unless k.to_s =~ /(.*)_param/
69
68
 
@@ -79,13 +78,8 @@ module Cucumber
79
78
  'comment' => 'grey',
80
79
  'tag' => 'cyan'
81
80
  )
82
- # :startdoc:
83
81
 
84
- # Apply the custom color scheme
85
- #
86
- # example:
87
- #
88
- # apply_custom_colors('passed=white')
82
+ # Apply the custom color scheme -> i.e. apply_custom_colors('passed=white')
89
83
  def self.apply_custom_colors(colors)
90
84
  colors.split(':').each do |pair|
91
85
  a = pair.split('=')
@@ -117,23 +111,21 @@ module Cucumber
117
111
  end
118
112
  end
119
113
 
120
- # :stopdoc:
121
- def cukes(n)
122
- ('(::) ' * n).strip
114
+ def cukes(amount)
115
+ ('(::) ' * amount).strip
123
116
  end
124
117
 
125
- def green_cukes(n)
126
- blink(green(cukes(n)))
118
+ def green_cukes(amount)
119
+ blink(green(cukes(amount)))
127
120
  end
128
121
 
129
- def red_cukes(n)
130
- blink(red(cukes(n)))
122
+ def red_cukes(amount)
123
+ blink(red(cukes(amount)))
131
124
  end
132
125
 
133
- def yellow_cukes(n)
134
- blink(yellow(cukes(n)))
126
+ def yellow_cukes(amount)
127
+ blink(yellow(cukes(amount)))
135
128
  end
136
- # :startdoc:
137
129
 
138
130
  private
139
131
 
@@ -43,9 +43,9 @@ module Cucumber
43
43
  format_string(line, status)
44
44
  end
45
45
 
46
- def format_string(o, status)
46
+ def format_string(input, status)
47
47
  fmt = format_for(status)
48
- o.to_s.split("\n").map do |line|
48
+ input.to_s.split("\n").map do |line|
49
49
  if fmt.instance_of?(Proc)
50
50
  fmt.call(line)
51
51
  else
@@ -92,16 +92,16 @@ module Cucumber
92
92
  @io.flush
93
93
  end
94
94
 
95
- def print_exception(e, status, indent)
96
- string = exception_message_string(e, indent)
95
+ def print_exception(exception, status, indent)
96
+ string = exception_message_string(exception, indent)
97
97
  @io.puts(format_string(string, status))
98
98
  end
99
99
 
100
- def exception_message_string(e, indent_amount)
101
- message = "#{e.message} (#{e.class})".dup.force_encoding('UTF-8')
100
+ def exception_message_string(exception, indent_amount)
101
+ message = "#{exception.message} (#{exception.class})".dup.force_encoding('UTF-8')
102
102
  message = linebreaks(message, ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
103
103
 
104
- indent("#{message}\n#{e.backtrace.join("\n")}", indent_amount)
104
+ indent("#{message}\n#{exception.backtrace.join("\n")}", indent_amount)
105
105
  end
106
106
 
107
107
  # http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/10655
@@ -14,9 +14,9 @@ module Cucumber
14
14
  @config.on_event(:test_case_finished) do |event|
15
15
  if event.test_case != @previous_test_case
16
16
  @previous_test_case = event.test_case
17
- @issues[event.result.to_sym] << event.test_case unless event.result.ok?(@config.strict)
17
+ @issues[event.result.to_sym] << event.test_case unless event.result.ok?(strict: @config.strict)
18
18
  elsif event.result.passed?
19
- @issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?(@config.strict.strict?(:flaky))
19
+ @issues[:flaky] << event.test_case unless Core::Test::Result::Flaky.ok?(strict: @config.strict.strict?(:flaky))
20
20
  @issues[:failed].delete(event.test_case)
21
21
  end
22
22
  end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'shellwords'
4
+
5
+ module Cucumber
6
+ module Formatter
7
+ class CurlOptionParser
8
+ def self.parse(options)
9
+ args = Shellwords.split(options)
10
+
11
+ url = nil
12
+ http_method = 'PUT'
13
+ headers = {}
14
+
15
+ until args.empty?
16
+ arg = args.shift
17
+ case arg
18
+ when '-X', '--request'
19
+ http_method = remove_arg_for(args, arg)
20
+ when '-H'
21
+ header_arg = remove_arg_for(args, arg)
22
+ headers = headers.merge(parse_header(header_arg))
23
+ else
24
+ raise StandardError, "#{options} was not a valid curl command. Can't set url to #{arg} it is already set to #{url}" if url
25
+
26
+ url = arg
27
+ end
28
+ end
29
+ raise StandardError, "#{options} was not a valid curl command" unless url
30
+
31
+ [url, http_method, headers]
32
+ end
33
+
34
+ # TODO: [LH] -> Switch below methods to private
35
+ def self.remove_arg_for(args, arg)
36
+ return args.shift unless args.empty?
37
+
38
+ raise StandardError, "Missing argument for #{arg}"
39
+ end
40
+
41
+ def self.parse_header(header_arg)
42
+ parts = header_arg.split(':', 2)
43
+ raise StandardError, "#{header_arg} was not a valid header" unless parts.length == 2
44
+
45
+ { parts[0].strip => parts[1].strip }
46
+ end
47
+ end
48
+ end
49
+ end
@@ -12,7 +12,7 @@ module Cucumber
12
12
  test_case, result = *event.attributes
13
13
  if test_case != @previous_test_case
14
14
  @previous_test_case = event.test_case
15
- Cucumber.wants_to_quit = true unless result.ok?(configuration.strict)
15
+ Cucumber.wants_to_quit = true unless result.ok?(strict: configuration.strict)
16
16
  elsif result.passed?
17
17
  Cucumber.wants_to_quit = false
18
18
  end
@@ -2,152 +2,18 @@
2
2
 
3
3
  require 'net/http'
4
4
  require 'tempfile'
5
- require 'shellwords'
5
+ require_relative 'curl_option_parser'
6
+ require_relative 'io_http_buffer'
6
7
 
7
8
  module Cucumber
8
9
  module Formatter
9
10
  class HTTPIO
10
- class << self
11
- # Returns an IO that will write to a HTTP request's body
12
- # https_verify_mode can be set to OpenSSL::SSL::VERIFY_NONE
13
- # to ignore unsigned certificate - setting to nil will verify the certificate
14
- def open(url, https_verify_mode = nil, reporter = nil)
15
- @https_verify_mode = https_verify_mode
16
- uri, method, headers = CurlOptionParser.parse(url)
17
- IOHTTPBuffer.new(uri, method, headers, https_verify_mode, reporter)
18
- end
19
- end
20
- end
21
-
22
- class CurlOptionParser
23
- def self.parse(options)
24
- args = Shellwords.split(options)
25
-
26
- url = nil
27
- http_method = 'PUT'
28
- headers = {}
29
-
30
- until args.empty?
31
- arg = args.shift
32
- case arg
33
- when '-X', '--request'
34
- http_method = remove_arg_for(args, arg)
35
- when '-H'
36
- header_arg = remove_arg_for(args, arg)
37
- headers = headers.merge(parse_header(header_arg))
38
- else
39
- raise StandardError, "#{options} was not a valid curl command. Can't set url to #{arg} it is already set to #{url}" if url
40
-
41
- url = arg
42
- end
43
- end
44
- raise StandardError, "#{options} was not a valid curl command" unless url
45
-
46
- [
47
- url,
48
- http_method,
49
- headers
50
- ]
51
- end
52
-
53
- def self.remove_arg_for(args, arg)
54
- return args.shift unless args.empty?
55
-
56
- raise StandardError, "Missing argument for #{arg}"
57
- end
58
-
59
- def self.parse_header(header_arg)
60
- parts = header_arg.split(':', 2)
61
- raise StandardError, "#{header_arg} was not a valid header" unless parts.length == 2
62
-
63
- { parts[0].strip => parts[1].strip }
64
- end
65
- end
66
-
67
- class IOHTTPBuffer
68
- attr_reader :uri, :method, :headers
69
-
70
- def initialize(uri, method, headers = {}, https_verify_mode = nil, reporter = nil)
71
- @uri = URI(uri)
72
- @method = method
73
- @headers = headers
74
- @write_io = Tempfile.new('cucumber', encoding: 'UTF-8')
75
- @https_verify_mode = https_verify_mode
76
- @reporter = reporter || NoReporter.new
77
- end
78
-
79
- def close
80
- response = send_content(@uri, @method, @headers)
81
- @reporter.report(response.body)
82
- @write_io.close
83
- return if response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPRedirection)
84
-
85
- raise StandardError, "request to #{uri} failed with status #{response.code}"
86
- end
87
-
88
- def write(data)
89
- @write_io.write(data)
90
- end
91
-
92
- def flush
93
- @write_io.flush
94
- end
95
-
96
- def closed?
97
- @write_io.closed?
98
- end
99
-
100
- private
101
-
102
- def send_content(uri, method, headers, attempt = 10)
103
- content = (method == 'GET' ? StringIO.new : @write_io)
104
- http = build_client(uri, @https_verify_mode)
105
-
106
- raise StandardError, "request to #{uri} failed (too many redirections)" if attempt <= 0
107
-
108
- req = build_request(
109
- uri,
110
- method,
111
- headers.merge(
112
- 'Content-Length' => content.size.to_s
113
- )
114
- )
115
-
116
- content.rewind
117
- req.body_stream = content
118
-
119
- begin
120
- response = http.request(req)
121
- rescue SystemCallError
122
- # We may get the redirect response before pushing the file.
123
- response = http.request(build_request(uri, method, headers))
124
- end
125
-
126
- case response
127
- when Net::HTTPAccepted
128
- send_content(URI(response['Location']), 'PUT', {}, attempt - 1) if response['Location']
129
- when Net::HTTPRedirection
130
- send_content(URI(response['Location']), method, headers, attempt - 1)
131
- end
132
- response
133
- end
134
-
135
- def build_request(uri, method, headers)
136
- method_class_name = "#{method[0].upcase}#{method[1..].downcase}"
137
- req = Net::HTTP.const_get(method_class_name).new(uri)
138
- headers.each do |header, value|
139
- req[header] = value
140
- end
141
- req
142
- end
143
-
144
- def build_client(uri, https_verify_mode)
145
- http = Net::HTTP.new(uri.hostname, uri.port)
146
- if uri.scheme == 'https'
147
- http.use_ssl = true
148
- http.verify_mode = https_verify_mode if https_verify_mode
149
- end
150
- http
11
+ # Returns an IO that will write to a HTTP request's body
12
+ # https_verify_mode can be set to OpenSSL::SSL::VERIFY_NONE
13
+ # to ignore unsigned certificate - setting to nil will verify the certificate
14
+ def self.open(url, https_verify_mode = nil, reporter = nil)
15
+ uri, method, headers = CurlOptionParser.parse(url)
16
+ IOHTTPBuffer.new(uri, method, headers, https_verify_mode, reporter)
151
17
  end
152
18
  end
153
19
  end
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Formatter
5
+ class IOHTTPBuffer
6
+ attr_reader :uri, :method, :headers
7
+
8
+ def initialize(uri, method, headers = {}, https_verify_mode = nil, reporter = nil)
9
+ @uri = URI(uri)
10
+ @method = method
11
+ @headers = headers
12
+ @write_io = Tempfile.new('cucumber', encoding: 'UTF-8')
13
+ @https_verify_mode = https_verify_mode
14
+ @reporter = reporter || NoReporter.new
15
+ end
16
+
17
+ def close
18
+ @reporter.report(response.body)
19
+ @write_io.close
20
+ return if response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPRedirection)
21
+
22
+ raise StandardError, "request to #{uri} failed with status #{response.code}"
23
+ end
24
+
25
+ def write(data)
26
+ @write_io.write(data)
27
+ end
28
+
29
+ def flush
30
+ @write_io.flush
31
+ end
32
+
33
+ def closed?
34
+ @write_io.closed?
35
+ end
36
+
37
+ private
38
+
39
+ def response
40
+ @response ||= send_content(uri, method, headers)
41
+ end
42
+
43
+ def send_content(uri, method, headers, attempts_remaining = 10)
44
+ content = (method == 'GET' ? StringIO.new : @write_io)
45
+ http = build_client(uri)
46
+
47
+ raise StandardError, "request to #{uri} failed (too many redirections)" if attempts_remaining <= 0
48
+
49
+ request = build_request(uri, method, headers.merge('Content-Length' => content.size.to_s))
50
+ content.rewind
51
+ request.body_stream = content
52
+
53
+ begin
54
+ response = http.request(request)
55
+ rescue SystemCallError
56
+ # We may get the redirect response before pushing the file.
57
+ response = http.request(build_request(uri, method, headers))
58
+ end
59
+
60
+ case response
61
+ when Net::HTTPAccepted
62
+ send_content(URI(response['Location']), 'PUT', {}, attempts_remaining - 1) if response['Location']
63
+ when Net::HTTPRedirection
64
+ send_content(URI(response['Location']), method, headers, attempts_remaining - 1)
65
+ end
66
+ response
67
+ end
68
+
69
+ def build_request(uri, method, headers)
70
+ method_class_name = "#{method[0].upcase}#{method[1..].downcase}"
71
+ Net::HTTP.const_get(method_class_name).new(uri).tap do |request|
72
+ headers.each do |header, value|
73
+ request[header] = value
74
+ end
75
+ end
76
+ end
77
+
78
+ def build_client(uri)
79
+ Net::HTTP.new(uri.hostname, uri.port).tap do |http|
80
+ if uri.scheme == 'https'
81
+ http.use_ssl = true
82
+ http.verify_mode = @https_verify_mode if @https_verify_mode
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -102,7 +102,7 @@ module Cucumber
102
102
  private
103
103
 
104
104
  def same_feature_as_previous_test_case?(test_case)
105
- current_feature[:uri] == test_case.location.file
105
+ @feature_hash&.fetch(:uri, nil) == test_case.location.file
106
106
  end
107
107
 
108
108
  def first_step_after_background?(test_step)
@@ -113,10 +113,6 @@ module Cucumber
113
113
  test_step.location.file.include?('lib/cucumber/')
114
114
  end
115
115
 
116
- def current_feature
117
- @feature_hash ||= {}
118
- end
119
-
120
116
  def feature_elements
121
117
  @feature_hash[:elements] ||= []
122
118
  end
@@ -54,7 +54,7 @@ module Cucumber
54
54
  test_step, result = *event.attributes
55
55
  return if @failing_test_step
56
56
 
57
- @failing_test_step = test_step unless result.ok?(@config.strict)
57
+ @failing_test_step = test_step unless result.ok?(strict: @config.strict)
58
58
  end
59
59
 
60
60
  def on_test_case_finished(event)
@@ -71,7 +71,7 @@ module Cucumber
71
71
  end
72
72
 
73
73
  def on_test_run_finished(_event)
74
- @features_data.each { |_file, data| end_feature(data) }
74
+ @features_data.each_value { |data| end_feature(data) }
75
75
  end
76
76
 
77
77
  private
@@ -111,7 +111,7 @@ module Cucumber
111
111
  scenario_source = @ast_lookup.scenario_source(test_case)
112
112
  keyword = scenario_source.type == :Scenario ? scenario_source.scenario.keyword : scenario_source.scenario_outline.keyword
113
113
  output = "#{keyword}: #{scenario}\n\n"
114
- return output if result.ok?(@config.strict)
114
+ return output if result.ok?(strict: @config.strict)
115
115
 
116
116
  if scenario_source.type == :Scenario
117
117
  if @failing_test_step
@@ -140,7 +140,7 @@ module Cucumber
140
140
  testcase_attributes = get_testcase_attributes(classname, name, duration, filename)
141
141
 
142
142
  @current_feature_data[:builder].testcase(testcase_attributes) do
143
- if !result.passed? && result.ok?(@config.strict)
143
+ if !result.passed? && result.ok?(strict: @config.strict)
144
144
  @current_feature_data[:builder].skipped
145
145
  @current_feature_data[:skipped] += 1
146
146
  elsif !result.passed?
@@ -132,7 +132,7 @@ module Cucumber
132
132
  @step_definitions_by_test_step.step_match_arguments(step).map do |argument|
133
133
  Cucumber::Messages::StepMatchArgument.new(
134
134
  group: argument_group_to_message(argument.group),
135
- parameter_type_name: argument.parameter_type.name
135
+ parameter_type_name: parameter_type_name(argument)
136
136
  )
137
137
  end
138
138
  end
@@ -145,6 +145,10 @@ module Cucumber
145
145
  )
146
146
  end
147
147
 
148
+ def parameter_type_name(step_match_argument)
149
+ step_match_argument.parameter_type&.name if step_match_argument.respond_to?(:parameter_type)
150
+ end
151
+
148
152
  def on_test_run_started(*)
149
153
  message = Cucumber::Messages::Envelope.new(
150
154
  test_run_started: Cucumber::Messages::TestRunStarted.new(
@@ -153,7 +153,7 @@ module Cucumber
153
153
  private
154
154
 
155
155
  def find_exception_to_be_printed(result)
156
- return nil if result.ok?(options[:strict])
156
+ return nil if result.ok?(strict: options[:strict])
157
157
 
158
158
  result = result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
159
159
  exception = result.failed? ? result.exception : result
@@ -14,7 +14,7 @@ module Cucumber
14
14
  config.on_event :test_case_finished do |event|
15
15
  test_case, result = *event.attributes
16
16
  if @config.strict.strict?(:flaky)
17
- next if result.ok?(@config.strict)
17
+ next if result.ok?(strict: @config.strict)
18
18
 
19
19
  add_to_failures(test_case)
20
20
  else
@@ -22,11 +22,11 @@ module Cucumber
22
22
  if @latest_failed_test_case != test_case
23
23
  add_to_failures(@latest_failed_test_case)
24
24
  @latest_failed_test_case = nil
25
- elsif result.ok?(@config.strict)
25
+ elsif result.ok?(strict: @config.strict)
26
26
  @latest_failed_test_case = nil
27
27
  end
28
28
  end
29
- @latest_failed_test_case = test_case unless result.ok?(@config.strict)
29
+ @latest_failed_test_case = test_case unless result.ok?(strict: @config.strict)
30
30
  end
31
31
  end
32
32
  config.on_event :test_run_finished do
@@ -13,7 +13,7 @@ module Cucumber
13
13
  end
14
14
 
15
15
  class NoReporter
16
- def report(banner); end
16
+ def report(_banner); end
17
17
  end
18
18
  end
19
19
  end
@@ -5,8 +5,7 @@ module Cucumber
5
5
  module Formatter
6
6
  # Defines aliases for ANSI coloured output. Default colours can be overridden by defining
7
7
  # a <tt>GHERKIN_COLORS</tt> variable in your shell, very much like how you can
8
- # tweak the familiar POSIX command <tt>ls</tt> with
9
- # $LSCOLORS: http://linux-sxs.org/housekeeping/lscolors.html
8
+ # tweak the familiar POSIX command <tt>ls</tt> with $LSCOLORS: http://linux-sxs.org/housekeeping/lscolors.html
10
9
  #
11
10
  # The colours that you can change are:
12
11
  #
@@ -87,8 +86,8 @@ module Cucumber
87
86
  "\e[0m"
88
87
  end
89
88
 
90
- def up(n)
91
- "\e[#{n}A"
89
+ def up(amount)
90
+ "\e[#{amount}A"
92
91
  end
93
92
  end
94
93
  end
@@ -27,7 +27,7 @@ module Cucumber
27
27
  # This will store <tt>[['a', 'b'], ['c', 'd']]</tt> in the <tt>data</tt> variable.
28
28
  #
29
29
  class DataTable
30
- def self.default_arg_name
30
+ def self.default_arg_name
31
31
  'table'
32
32
  end
33
33
 
@@ -200,7 +200,7 @@ module Cucumber
200
200
 
201
201
  def rows
202
202
  hashes.map do |hash|
203
- hash.values_at *headers
203
+ hash.values_at(*headers)
204
204
  end
205
205
  end
206
206
 
@@ -354,11 +354,11 @@ module Cucumber
354
354
  cells_rows.index(cells)
355
355
  end
356
356
 
357
- def verify_column(column_name)
357
+ def verify_column(column_name)
358
358
  raise %(The column named "#{column_name}" does not exist) unless raw[0].include?(column_name)
359
359
  end
360
360
 
361
- def verify_table_width(width)
361
+ def verify_table_width(width)
362
362
  raise %(The table must have exactly #{width} columns) unless raw[0].size == width
363
363
  end
364
364
 
@@ -384,17 +384,17 @@ module Cucumber
384
384
 
385
385
  attr_reader :cell_matrix
386
386
 
387
- def col_width(col)
387
+ def col_width(col)
388
388
  columns[col].__send__(:width)
389
389
  end
390
390
 
391
- def to_s(options = {})
391
+ def to_s(options = {})
392
392
  indentation = options.key?(:indent) ? options[:indent] : 2
393
393
  prefixes = options.key?(:prefixes) ? options[:prefixes] : TO_S_PREFIXES
394
394
  DataTablePrinter.new(self, indentation, prefixes).to_s
395
395
  end
396
396
 
397
- class DataTablePrinter
397
+ class DataTablePrinter
398
398
  include Cucumber::Gherkin::Formatter::Escaping
399
399
  attr_reader :data_table, :indentation, :prefixes
400
400
  private :data_table, :indentation, :prefixes
@@ -433,7 +433,7 @@ module Cucumber
433
433
  end
434
434
  end
435
435
 
436
- def columns
436
+ def columns
437
437
  @columns ||= cell_matrix.transpose.map do |cell_row|
438
438
  Cells.new(self, cell_row)
439
439
  end
@@ -456,7 +456,7 @@ module Cucumber
456
456
  cells_rows[1..].map(&:to_hash)
457
457
  end
458
458
 
459
- def create_cell_matrix(ast_table)
459
+ def create_cell_matrix(ast_table)
460
460
  ast_table.raw.map do |raw_row|
461
461
  line = begin
462
462
  raw_row.line
@@ -469,7 +469,7 @@ module Cucumber
469
469
  end
470
470
  end
471
471
 
472
- def convert_columns!
472
+ def convert_columns!
473
473
  @conversion_procs.each do |column_name, conversion_proc|
474
474
  verify_column(column_name) if conversion_proc[:strict]
475
475
  end
@@ -483,7 +483,7 @@ module Cucumber
483
483
  end
484
484
  end
485
485
 
486
- def convert_headers!
486
+ def convert_headers!
487
487
  header_cells = cell_matrix[0]
488
488
 
489
489
  if @header_conversion_proc
@@ -501,11 +501,11 @@ module Cucumber
501
501
  end
502
502
  end
503
503
 
504
- def clear_cache!
504
+ def clear_cache!
505
505
  @hashes = @rows_hash = @column_names = @rows = @columns = nil
506
506
  end
507
507
 
508
- def ensure_table(table_or_array)
508
+ def ensure_table(table_or_array)
509
509
  return table_or_array if table_or_array.instance_of?(DataTable)
510
510
 
511
511
  DataTable.from(table_or_array)
@@ -516,7 +516,7 @@ module Cucumber
516
516
  end
517
517
 
518
518
  # Represents a row of cells or columns of cells
519
- class Cells
519
+ class Cells
520
520
  include Enumerable
521
521
  include Cucumber::Gherkin::Formatter::Escaping
522
522
 
@@ -536,21 +536,20 @@ module Cucumber
536
536
  nil
537
537
  end
538
538
 
539
- # For testing only
540
- def to_sexp
539
+ def to_sexp
541
540
  [:row, line, *@cells.map(&:to_sexp)]
542
541
  end
543
542
 
544
- def to_hash
543
+ def to_hash
545
544
  @to_hash ||= @table.cells_to_hash(self)
546
545
  end
547
546
 
548
- def value(n)
549
- self[n].value
547
+ def value(index)
548
+ self[index].value
550
549
  end
551
550
 
552
- def [](n)
553
- @cells[n]
551
+ def [](index)
552
+ @cells[index]
554
553
  end
555
554
 
556
555
  def line
@@ -576,7 +575,7 @@ module Cucumber
576
575
  end
577
576
  end
578
577
 
579
- class Cell
578
+ class Cell
580
579
  attr_reader :line, :table
581
580
  attr_accessor :status, :value
582
581
 
@@ -603,12 +602,12 @@ module Cucumber
603
602
  end
604
603
 
605
604
  # For testing only
606
- def to_sexp
605
+ def to_sexp
607
606
  [:cell, @value]
608
607
  end
609
608
  end
610
609
 
611
- class SurplusCell < Cell
610
+ class SurplusCell < Cell
612
611
  def status
613
612
  :comment
614
613
  end
@@ -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)
@@ -114,7 +114,7 @@ module Cucumber
114
114
  if @configuration.wip?
115
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.1
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-01-04 00:00:00.000000000 Z
13
+ date: 2024-03-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: builder
@@ -19,9 +19,6 @@ dependencies:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: '3.2'
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 3.2.4
25
22
  type: :runtime
26
23
  prerelease: false
27
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,43 +26,46 @@ dependencies:
29
26
  - - "~>"
30
27
  - !ruby/object:Gem::Version
31
28
  version: '3.2'
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 3.2.4
35
29
  - !ruby/object:Gem::Dependency
36
30
  name: cucumber-ci-environment
37
31
  requirement: !ruby/object:Gem::Requirement
38
32
  requirements:
39
- - - "~>"
33
+ - - ">"
40
34
  - !ruby/object:Gem::Version
41
- version: '9.2'
42
- - - ">="
35
+ version: '9'
36
+ - - "<"
43
37
  - !ruby/object:Gem::Version
44
- version: 9.2.0
38
+ version: '11'
45
39
  type: :runtime
46
40
  prerelease: false
47
41
  version_requirements: !ruby/object:Gem::Requirement
48
42
  requirements:
49
- - - "~>"
43
+ - - ">"
50
44
  - !ruby/object:Gem::Version
51
- version: '9.2'
52
- - - ">="
45
+ version: '9'
46
+ - - "<"
53
47
  - !ruby/object:Gem::Version
54
- version: 9.2.0
48
+ version: '11'
55
49
  - !ruby/object:Gem::Dependency
56
50
  name: cucumber-core
57
51
  requirement: !ruby/object:Gem::Requirement
58
52
  requirements:
59
- - - "~>"
53
+ - - ">"
54
+ - !ruby/object:Gem::Version
55
+ version: '13'
56
+ - - "<"
60
57
  - !ruby/object:Gem::Version
61
- version: '12.0'
58
+ version: '14'
62
59
  type: :runtime
63
60
  prerelease: false
64
61
  version_requirements: !ruby/object:Gem::Requirement
65
62
  requirements:
66
- - - "~>"
63
+ - - ">"
67
64
  - !ruby/object:Gem::Version
68
- version: '12.0'
65
+ version: '13'
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '14'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cucumber-cucumber-expressions
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -89,7 +89,7 @@ dependencies:
89
89
  version: '24'
90
90
  - - "<"
91
91
  - !ruby/object:Gem::Version
92
- version: '27'
92
+ version: '28'
93
93
  type: :runtime
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '24'
100
100
  - - "<"
101
101
  - !ruby/object:Gem::Version
102
- version: '27'
102
+ version: '28'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: cucumber-html-formatter
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -161,9 +161,6 @@ dependencies:
161
161
  - - "~>"
162
162
  - !ruby/object:Gem::Version
163
163
  version: '1.1'
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: 1.1.5
167
164
  type: :runtime
168
165
  prerelease: false
169
166
  version_requirements: !ruby/object:Gem::Requirement
@@ -171,9 +168,6 @@ dependencies:
171
168
  - - "~>"
172
169
  - !ruby/object:Gem::Version
173
170
  version: '1.1'
174
- - - ">="
175
- - !ruby/object:Gem::Version
176
- version: 1.1.5
177
171
  - !ruby/object:Gem::Dependency
178
172
  name: multi_test
179
173
  requirement: !ruby/object:Gem::Requirement
@@ -181,9 +175,6 @@ dependencies:
181
175
  - - "~>"
182
176
  - !ruby/object:Gem::Version
183
177
  version: '1.1'
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- version: 1.1.0
187
178
  type: :runtime
188
179
  prerelease: false
189
180
  version_requirements: !ruby/object:Gem::Requirement
@@ -191,9 +182,6 @@ dependencies:
191
182
  - - "~>"
192
183
  - !ruby/object:Gem::Version
193
184
  version: '1.1'
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- version: 1.1.0
197
185
  - !ruby/object:Gem::Dependency
198
186
  name: sys-uname
199
187
  requirement: !ruby/object:Gem::Requirement
@@ -201,9 +189,6 @@ dependencies:
201
189
  - - "~>"
202
190
  - !ruby/object:Gem::Version
203
191
  version: '1.2'
204
- - - ">="
205
- - !ruby/object:Gem::Version
206
- version: 1.2.3
207
192
  type: :runtime
208
193
  prerelease: false
209
194
  version_requirements: !ruby/object:Gem::Requirement
@@ -211,23 +196,20 @@ dependencies:
211
196
  - - "~>"
212
197
  - !ruby/object:Gem::Version
213
198
  version: '1.2'
214
- - - ">="
215
- - !ruby/object:Gem::Version
216
- version: 1.2.3
217
199
  - !ruby/object:Gem::Dependency
218
200
  name: cucumber-compatibility-kit
219
201
  requirement: !ruby/object:Gem::Requirement
220
202
  requirements:
221
203
  - - "~>"
222
204
  - !ruby/object:Gem::Version
223
- version: '14.1'
205
+ version: '15.0'
224
206
  type: :development
225
207
  prerelease: false
226
208
  version_requirements: !ruby/object:Gem::Requirement
227
209
  requirements:
228
210
  - - "~>"
229
211
  - !ruby/object:Gem::Version
230
- version: '14.1'
212
+ version: '15.0'
231
213
  - !ruby/object:Gem::Dependency
232
214
  name: nokogiri
233
215
  requirement: !ruby/object:Gem::Requirement
@@ -430,6 +412,7 @@ files:
430
412
  - lib/cucumber/formatter/console.rb
431
413
  - lib/cucumber/formatter/console_counts.rb
432
414
  - lib/cucumber/formatter/console_issues.rb
415
+ - lib/cucumber/formatter/curl_option_parser.rb
433
416
  - lib/cucumber/formatter/duration.rb
434
417
  - lib/cucumber/formatter/duration_extractor.rb
435
418
  - lib/cucumber/formatter/errors.rb
@@ -440,6 +423,7 @@ files:
440
423
  - lib/cucumber/formatter/ignore_missing_messages.rb
441
424
  - lib/cucumber/formatter/interceptor.rb
442
425
  - lib/cucumber/formatter/io.rb
426
+ - lib/cucumber/formatter/io_http_buffer.rb
443
427
  - lib/cucumber/formatter/json.rb
444
428
  - lib/cucumber/formatter/junit.rb
445
429
  - lib/cucumber/formatter/message.rb
@@ -529,5 +513,5 @@ requirements: []
529
513
  rubygems_version: 3.3.5
530
514
  signing_key:
531
515
  specification_version: 4
532
- summary: cucumber-9.1.1
516
+ summary: cucumber-9.2.0
533
517
  test_files: []