cucumber 9.0.0 → 9.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -13
- data/VERSION +1 -0
- data/lib/cucumber/cli/options.rb +8 -8
- data/lib/cucumber/deprecate.rb +1 -1
- data/lib/cucumber/errors.rb +2 -1
- data/lib/cucumber/events/envelope.rb +2 -0
- data/lib/cucumber/events/gherkin_source_parsed.rb +2 -0
- data/lib/cucumber/events/gherkin_source_read.rb +2 -0
- data/lib/cucumber/events/test_case_finished.rb +2 -0
- data/lib/cucumber/events/test_case_started.rb +2 -0
- data/lib/cucumber/events/test_step_finished.rb +2 -0
- data/lib/cucumber/events/test_step_started.rb +2 -0
- data/lib/cucumber/events/undefined_parameter_type.rb +2 -0
- data/lib/cucumber/file_specs.rb +1 -1
- data/lib/cucumber/formatter/console.rb +2 -5
- data/lib/cucumber/formatter/console_counts.rb +3 -1
- data/lib/cucumber/formatter/console_issues.rb +2 -0
- data/lib/cucumber/formatter/errors.rb +2 -0
- data/lib/cucumber/formatter/html.rb +2 -0
- data/lib/cucumber/formatter/http_io.rb +2 -0
- data/lib/cucumber/formatter/message_builder.rb +2 -0
- data/lib/cucumber/formatter/pretty.rb +1 -1
- data/lib/cucumber/formatter/publish_banner_printer.rb +0 -2
- data/lib/cucumber/formatter/query/hook_by_test_step.rb +2 -0
- data/lib/cucumber/formatter/query/pickle_by_test.rb +2 -0
- data/lib/cucumber/formatter/query/pickle_step_by_test_step.rb +2 -0
- data/lib/cucumber/formatter/query/step_definitions_by_test_step.rb +2 -0
- data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +2 -0
- data/lib/cucumber/formatter/unicode.rb +3 -3
- data/lib/cucumber/formatter/url_reporter.rb +2 -0
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +4 -5
- data/lib/cucumber/glue/invoke_in_world.rb +1 -1
- data/lib/cucumber/glue/proto_world.rb +2 -2
- data/lib/cucumber/glue/registry_and_more.rb +2 -1
- data/lib/cucumber/glue/snippet.rb +4 -2
- data/lib/cucumber/glue/world_factory.rb +2 -0
- data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +2 -0
- data/lib/cucumber/multiline_argument/data_table.rb +2 -2
- data/lib/cucumber/platform.rb +11 -16
- data/lib/cucumber/runtime/meta_message_builder.rb +2 -0
- data/lib/cucumber/runtime.rb +3 -3
- data/lib/cucumber/step_match.rb +1 -1
- data/lib/cucumber/term/ansicolor.rb +1 -1
- data/lib/cucumber/term/banner.rb +2 -0
- metadata +169 -96
- data/CHANGELOG.old.md +0 -3371
- data/CONTRIBUTING.md +0 -246
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 313150f1f463d99e105864744641cd87c56e55f5d4d7856a437214a8db79dbdd
|
4
|
+
data.tar.gz: 90cdd041c890ab05108d3951be679f424ae096bc2df09044b26320096074eee3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76252cc34ed4bc38ba6e7c0cec30d31b5319d14cdc9745f3e589bad8abf4713c95ec27527095b969dfd983f59ecea57f27ef9d119b68f8c032a19143d332d549
|
7
|
+
data.tar.gz: bef2260cd88f77daa139256c03e68b1744849667d71a3a71931d6c57a4c546e437e996ef6e7aed157520d5ff7dc1b86d2c1a1041b9dd9747f20fe53fd61dec2a
|
data/README.md
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
<
|
2
|
-
<img src="./.github/img/cucumber-open-logo.png" alt="Cucumber Open - Supported by Smartbear" width="428" />
|
3
|
-
</p>
|
1
|
+
<img src="docs/img/cucumber-open-logo.png" alt="Cucumber Open - Supported by Smartbear" width="428" />
|
4
2
|
|
5
3
|
# Cucumber
|
6
4
|
|
@@ -18,9 +16,7 @@ written in plain language, they can be read by anyone on your team. Because they
|
|
18
16
|
read by anyone, you can use them to help improve communication, collaboration and trust on
|
19
17
|
your team.
|
20
18
|
|
21
|
-
<
|
22
|
-
<img src="./.github/img/gherkin-example.png" alt="Cucumber Gherkin Example" width="728" />
|
23
|
-
</p>
|
19
|
+
<img src="docs/img/gherkin-example.png" alt="Cucumber Gherkin Example" width="728" />
|
24
20
|
|
25
21
|
This is the Ruby implementation of Cucumber. Cucumber is also available for [JavaScript](https://github.com/cucumber/cucumber-js),
|
26
22
|
[Java](https://github.com/cucumber/cucumber-jvm), and a lot of other languages. You can find a list of implementations here: https://cucumber.io/docs/installation/.
|
@@ -56,8 +52,7 @@ Later in this document, bundler is considered being used so all commands are usi
|
|
56
52
|
- Ruby 3.0
|
57
53
|
- Ruby 2.7
|
58
54
|
- TruffleRuby 22.0.0+
|
59
|
-
- JRuby (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md))
|
60
|
-
- 9.4
|
55
|
+
- JRuby 9.4+ (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md))
|
61
56
|
|
62
57
|
### Ruby on Rails
|
63
58
|
|
@@ -109,19 +104,20 @@ And a file named `steps.rb` in `features/step_definitions` with:
|
|
109
104
|
```ruby
|
110
105
|
# features/step_definitions/steps.rb
|
111
106
|
|
112
|
-
Given(
|
107
|
+
Given('this will pass') do
|
113
108
|
@this_will_pass = true
|
114
109
|
end
|
115
110
|
|
116
|
-
Given(
|
111
|
+
Given('this will fail') do
|
117
112
|
@this_will_pass = false
|
118
113
|
end
|
119
114
|
|
120
|
-
When(
|
115
|
+
When('I do an action') do
|
116
|
+
:no_op
|
121
117
|
end
|
122
118
|
|
123
119
|
Then("some results should be there") do
|
124
|
-
expect(@this_will_pass)
|
120
|
+
expect(@this_will_pass).to be true
|
125
121
|
end
|
126
122
|
```
|
127
123
|
|
@@ -135,7 +131,7 @@ To execute a single feature file:
|
|
135
131
|
|
136
132
|
To execute a single example, indicates the line of the name of the example:
|
137
133
|
|
138
|
-
$ bundle exec cucumber features/rule.feature:
|
134
|
+
$ bundle exec cucumber features/rule.feature:5
|
139
135
|
|
140
136
|
To summarize the results on the standard output, and writte a HTML report on disk:
|
141
137
|
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
9.0.2
|
data/lib/cucumber/cli/options.rb
CHANGED
@@ -50,13 +50,13 @@ module Cucumber
|
|
50
50
|
FORMAT_HELP = (BUILTIN_FORMATS.keys.sort.map do |key|
|
51
51
|
" #{key}#{' ' * (max - key.length)} : #{BUILTIN_FORMATS[key][1]}"
|
52
52
|
end) + FORMAT_HELP_MSG
|
53
|
-
PROFILE_SHORT_FLAG = '-p'
|
54
|
-
NO_PROFILE_SHORT_FLAG = '-P'
|
55
|
-
PROFILE_LONG_FLAG = '--profile'
|
56
|
-
NO_PROFILE_LONG_FLAG = '--no-profile'
|
57
|
-
FAIL_FAST_FLAG = '--fail-fast'
|
58
|
-
RETRY_FLAG = '--retry'
|
59
|
-
RETRY_TOTAL_FLAG = '--retry-total'
|
53
|
+
PROFILE_SHORT_FLAG = '-p'
|
54
|
+
NO_PROFILE_SHORT_FLAG = '-P'
|
55
|
+
PROFILE_LONG_FLAG = '--profile'
|
56
|
+
NO_PROFILE_LONG_FLAG = '--no-profile'
|
57
|
+
FAIL_FAST_FLAG = '--fail-fast'
|
58
|
+
RETRY_FLAG = '--retry'
|
59
|
+
RETRY_TOTAL_FLAG = '--retry-total'
|
60
60
|
OPTIONS_WITH_ARGS = [
|
61
61
|
'-r', '--require', '--i18n-keywords', '-f', '--format', '-o',
|
62
62
|
'--out', '-t', '--tags', '-n', '--name', '-e', '--exclude',
|
@@ -64,7 +64,7 @@ module Cucumber
|
|
64
64
|
'-l', '--lines', '--port', '-I', '--snippet-type'
|
65
65
|
].freeze
|
66
66
|
ORDER_TYPES = %w[defined random].freeze
|
67
|
-
TAG_LIMIT_MATCHER = /(?<tag_name>@\w+):(?<limit>\d+)/x
|
67
|
+
TAG_LIMIT_MATCHER = /(?<tag_name>@\w+):(?<limit>\d+)/x.freeze
|
68
68
|
|
69
69
|
def self.parse(args, out_stream, error_stream, options = {})
|
70
70
|
new(out_stream, error_stream, options).parse!(args)
|
data/lib/cucumber/deprecate.rb
CHANGED
@@ -42,7 +42,7 @@ module Cucumber
|
|
42
42
|
|
43
43
|
module ForDevelopers
|
44
44
|
def self.call(_message, _method, remove_after_version)
|
45
|
-
raise "This method is due for removal after version #{remove_after_version}" if Cucumber::VERSION
|
45
|
+
raise "This method is due for removal after version #{remove_after_version}" if remove_after_version <= Cucumber::VERSION
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
data/lib/cucumber/errors.rb
CHANGED
@@ -35,7 +35,8 @@ module Cucumber
|
|
35
35
|
# Raised when a step matches 2 or more StepDefinitions
|
36
36
|
class Ambiguous < StandardError
|
37
37
|
def initialize(step_name, step_definitions, used_guess)
|
38
|
-
|
38
|
+
# TODO: [LH] - Just use a heredoc here to fix this up
|
39
|
+
message = String.new
|
39
40
|
message << "Ambiguous match of \"#{step_name}\":\n\n"
|
40
41
|
message << step_definitions.map(&:backtrace_line).join("\n")
|
41
42
|
message << "\n\n"
|
data/lib/cucumber/file_specs.rb
CHANGED
@@ -5,7 +5,7 @@ require 'cucumber/core/test/location'
|
|
5
5
|
|
6
6
|
module Cucumber
|
7
7
|
class FileSpecs
|
8
|
-
FILE_COLON_LINE_PATTERN = /^([\w\W]*?)(?::([\d:]+))
|
8
|
+
FILE_COLON_LINE_PATTERN = /^([\w\W]*?)(?::([\d:]+))?$/.freeze # :nodoc:
|
9
9
|
|
10
10
|
def initialize(file_specs)
|
11
11
|
Cucumber.logger.debug("Features:\n")
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# rubocop:disable Metrics/ModuleLength
|
4
|
-
|
5
3
|
require 'cucumber/formatter/ansicolor'
|
6
4
|
require 'cucumber/formatter/duration'
|
7
5
|
require 'cucumber/gherkin/i18n'
|
@@ -48,7 +46,7 @@ module Cucumber
|
|
48
46
|
def format_string(o, status)
|
49
47
|
fmt = format_for(status)
|
50
48
|
o.to_s.split("\n").map do |line|
|
51
|
-
if
|
49
|
+
if fmt.instance_of?(Proc)
|
52
50
|
fmt.call(line)
|
53
51
|
else
|
54
52
|
fmt % line
|
@@ -108,7 +106,7 @@ module Cucumber
|
|
108
106
|
|
109
107
|
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/10655
|
110
108
|
def linebreaks(msg, max)
|
111
|
-
return msg unless max
|
109
|
+
return msg unless max.positive?
|
112
110
|
|
113
111
|
msg.gsub(/.{1,#{max}}(?:\s|\Z)/) do
|
114
112
|
(Regexp.last_match(0) + 5.chr).gsub(/\n\005/, "\n").gsub(/\005/, "\n")
|
@@ -262,4 +260,3 @@ module Cucumber
|
|
262
260
|
end
|
263
261
|
end
|
264
262
|
end
|
265
|
-
# rubocop:enable Metrics/ModuleLength
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cucumber/formatter/console'
|
2
4
|
|
3
5
|
module Cucumber
|
@@ -30,7 +32,7 @@ module Cucumber
|
|
30
32
|
|
31
33
|
def status_counts(summary)
|
32
34
|
counts = Core::Test::Result::TYPES.map { |status| [status, summary.total(status)] }
|
33
|
-
counts = counts.select { |_status, count| count
|
35
|
+
counts = counts.select { |_status, count| count.positive? }
|
34
36
|
counts = counts.map { |status, count| format_string("#{count} #{status}", status) }
|
35
37
|
"(#{counts.join(', ')})" if counts.any?
|
36
38
|
end
|
@@ -15,7 +15,6 @@ module Cucumber
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
# rubocop:disable Metrics/MethodLength
|
19
18
|
def display_publish_ad(io)
|
20
19
|
display_banner(
|
21
20
|
[
|
@@ -59,7 +58,6 @@ module Cucumber
|
|
59
58
|
io
|
60
59
|
)
|
61
60
|
end
|
62
|
-
# rubocop:enable Metrics/MethodLength
|
63
61
|
|
64
62
|
def highlight(text)
|
65
63
|
[text, :cyan]
|
@@ -10,13 +10,13 @@ if Cucumber::WINDOWS
|
|
10
10
|
Cucumber::CODEPAGE = ENV['CUCUMBER_OUTPUT_ENCODING']
|
11
11
|
elsif `cmd /c chcp` =~ /(\d+)/
|
12
12
|
if [65_000, 65_001].include? Regexp.last_match(1).to_i
|
13
|
-
Cucumber::CODEPAGE = 'UTF-8'
|
13
|
+
Cucumber::CODEPAGE = 'UTF-8'
|
14
14
|
ENV['ANSICON_API'] = 'ruby'
|
15
15
|
else
|
16
|
-
Cucumber::CODEPAGE = "cp#{Regexp.last_match(1).to_i}"
|
16
|
+
Cucumber::CODEPAGE = "cp#{Regexp.last_match(1).to_i}"
|
17
17
|
end
|
18
18
|
else
|
19
|
-
Cucumber::CODEPAGE = 'cp1252'
|
19
|
+
Cucumber::CODEPAGE = 'cp1252'
|
20
20
|
$stderr.puts("WARNING: Couldn't detect your output codepage. Assuming it is 1252. You may have to chcp 1252 or SET CUCUMBER_OUTPUT_ENCODING=cp1252.")
|
21
21
|
end
|
22
22
|
|
@@ -67,11 +67,10 @@ module Cucumber
|
|
67
67
|
'tag' => 'cyan'
|
68
68
|
)
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
70
|
+
# Example: export GHERKIN_COLORS="passed=red:failed=yellow"
|
71
|
+
ENV.fetch('GHERKIN_COLORS', '').split(':').each do |pair|
|
72
|
+
rule, colour = pair.split('=')
|
73
|
+
ALIASES[colour] = rule
|
75
74
|
end
|
76
75
|
|
77
76
|
ALIASES.each_key do |key|
|
@@ -28,7 +28,7 @@ module Cucumber
|
|
28
28
|
if check_arity && !cucumber_compatible_arity?(args, block)
|
29
29
|
world.instance_exec do
|
30
30
|
ari = block.arity
|
31
|
-
ari = ari
|
31
|
+
ari = ari.negative? ? "#{ari.abs - 1}+" : ari
|
32
32
|
s1 = ari == 1 ? '' : 's'
|
33
33
|
s2 = args.length == 1 ? '' : 's'
|
34
34
|
raise ArityMismatchError, "Your block takes #{ari} argument#{s1}, but the Regexp matched #{args.length} argument#{s2}."
|
@@ -26,7 +26,7 @@ module Cucumber
|
|
26
26
|
# @example Passing a multiline string
|
27
27
|
# step "the email should contain:", "Dear sir,\nYou've won a prize!\n"
|
28
28
|
# @param [String] name The name of the step
|
29
|
-
# @param [String,Cucumber::Test::DocString,Cucumber::Ast::Table] multiline_argument
|
29
|
+
# @param [String, Cucumber::Test::DocString, Cucumber::Ast::Table] multiline_argument
|
30
30
|
def step(name, raw_multiline_arg = nil)
|
31
31
|
super
|
32
32
|
end
|
@@ -128,7 +128,7 @@ module Cucumber
|
|
128
128
|
|
129
129
|
# Dynamially generate the API module, closuring the dependencies
|
130
130
|
def self.for(runtime, language) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
131
|
-
Module.new do
|
131
|
+
Module.new do
|
132
132
|
def self.extended(object)
|
133
133
|
# wrap the dynamically generated module so that we can document the methods
|
134
134
|
# for yardoc, which doesn't like define_method.
|
@@ -29,7 +29,8 @@ module Cucumber
|
|
29
29
|
# Raised if there are 2 or more World blocks.
|
30
30
|
class MultipleWorld < StandardError
|
31
31
|
def initialize(first_proc, second_proc)
|
32
|
-
|
32
|
+
# TODO: [LH] - Just use a heredoc here to fix this up
|
33
|
+
message = String.new
|
33
34
|
message << "You can only pass a proc to #World once, but it's happening\n"
|
34
35
|
message << "in 2 places:\n\n"
|
35
36
|
message << Glue.backtrace_line(first_proc, 'World') << "\n"
|
@@ -61,7 +61,8 @@ module Cucumber
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def do_block
|
64
|
-
|
64
|
+
# TODO: [LH] - Just use a heredoc here to fix this up
|
65
|
+
do_block = String.new
|
65
66
|
do_block << "do#{parameters}\n"
|
66
67
|
multiline_argument.append_comment_to(do_block)
|
67
68
|
do_block << " pending # Write code here that turns the phrase above into concrete actions\n"
|
@@ -95,7 +96,8 @@ module Cucumber
|
|
95
96
|
"#{prefix}#{code_keyword}('#{expr.source}') do#{parameters(expr)}"
|
96
97
|
end.join("\n")
|
97
98
|
|
98
|
-
|
99
|
+
# TODO: [LH] - Just use a heredoc here to fix this up
|
100
|
+
body = String.new
|
99
101
|
multiline_argument.append_comment_to(body)
|
100
102
|
body << " pending # Write code here that turns the phrase above into concrete actions\n"
|
101
103
|
body << 'end'
|
@@ -506,7 +506,7 @@ module Cucumber
|
|
506
506
|
end
|
507
507
|
|
508
508
|
def ensure_table(table_or_array) # :nodoc:
|
509
|
-
return table_or_array if
|
509
|
+
return table_or_array if table_or_array.instance_of?(DataTable)
|
510
510
|
|
511
511
|
DataTable.from(table_or_array)
|
512
512
|
end
|
@@ -591,7 +591,7 @@ module Cucumber
|
|
591
591
|
end
|
592
592
|
|
593
593
|
def ==(other)
|
594
|
-
|
594
|
+
other.class == SurplusCell || value == other.value
|
595
595
|
end
|
596
596
|
|
597
597
|
def eql?(other)
|
data/lib/cucumber/platform.rb
CHANGED
@@ -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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
18
|
-
|
13
|
+
class << self
|
14
|
+
attr_accessor :use_full_backtrace
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
data/lib/cucumber/runtime.rb
CHANGED
@@ -112,7 +112,7 @@ module Cucumber
|
|
112
112
|
|
113
113
|
def failure?
|
114
114
|
if @configuration.wip?
|
115
|
-
summary_report.test_cases.total_passed
|
115
|
+
summary_report.test_cases.total_passed.positive?
|
116
116
|
else
|
117
117
|
!summary_report.ok?(@configuration.strict)
|
118
118
|
end
|
@@ -150,8 +150,8 @@ module Cucumber
|
|
150
150
|
end
|
151
151
|
|
152
152
|
class NormalisedEncodingFile
|
153
|
-
COMMENT_OR_EMPTY_LINE_PATTERN = /^\s*#|^\s
|
154
|
-
ENCODING_PATTERN = /^\s*#\s*encoding\s*:\s*([^\s]+)
|
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
|
data/lib/cucumber/step_match.rb
CHANGED