cucumber 8.0.0 → 9.0.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.
- checksums.yaml +4 -4
- data/README.md +10 -15
- data/VERSION +1 -0
- data/lib/cucumber/cli/options.rb +21 -10
- data/lib/cucumber/configuration.rb +6 -1
- 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/filters/retry.rb +20 -1
- data/lib/cucumber/formatter/ansicolor.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 +4 -4
- 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/rake/task.rb +1 -1
- 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 +168 -102
- data/CHANGELOG.md +0 -3231
- data/CONTRIBUTING.md +0 -246
- data/lib/cucumber/version +0 -1
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/.
|
@@ -51,14 +47,12 @@ Later in this document, bundler is considered being used so all commands are usi
|
|
51
47
|
|
52
48
|
### Supported platforms
|
53
49
|
|
50
|
+
- Ruby 3.2
|
54
51
|
- Ruby 3.1
|
55
52
|
- Ruby 3.0
|
56
53
|
- Ruby 2.7
|
57
|
-
- Ruby 2.6
|
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.3 >= 9.3.1 (there is a known issue with JRuby 9.3.0. More info can
|
61
|
-
be found in the [PR#1571](https://github.com/cucumber/cucumber-ruby/pull/1571).)
|
55
|
+
- JRuby 9.4+ (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md))
|
62
56
|
|
63
57
|
### Ruby on Rails
|
64
58
|
|
@@ -110,19 +104,20 @@ And a file named `steps.rb` in `features/step_definitions` with:
|
|
110
104
|
```ruby
|
111
105
|
# features/step_definitions/steps.rb
|
112
106
|
|
113
|
-
Given(
|
107
|
+
Given('this will pass') do
|
114
108
|
@this_will_pass = true
|
115
109
|
end
|
116
110
|
|
117
|
-
Given(
|
111
|
+
Given('this will fail') do
|
118
112
|
@this_will_pass = false
|
119
113
|
end
|
120
114
|
|
121
|
-
When(
|
115
|
+
When('I do an action') do
|
116
|
+
:no_op
|
122
117
|
end
|
123
118
|
|
124
119
|
Then("some results should be there") do
|
125
|
-
expect(@this_will_pass)
|
120
|
+
expect(@this_will_pass).to be true
|
126
121
|
end
|
127
122
|
```
|
128
123
|
|
@@ -136,7 +131,7 @@ To execute a single feature file:
|
|
136
131
|
|
137
132
|
To execute a single example, indicates the line of the name of the example:
|
138
133
|
|
139
|
-
$ bundle exec cucumber features/rule.feature:
|
134
|
+
$ bundle exec cucumber features/rule.feature:5
|
140
135
|
|
141
136
|
To summarize the results on the standard output, and writte a HTML report on disk:
|
142
137
|
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
9.0.2
|
data/lib/cucumber/cli/options.rb
CHANGED
@@ -50,20 +50,21 @@ 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'
|
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'
|
59
60
|
OPTIONS_WITH_ARGS = [
|
60
61
|
'-r', '--require', '--i18n-keywords', '-f', '--format', '-o',
|
61
62
|
'--out', '-t', '--tags', '-n', '--name', '-e', '--exclude',
|
62
|
-
PROFILE_SHORT_FLAG, PROFILE_LONG_FLAG, RETRY_FLAG,
|
63
|
-
'--lines', '--port', '-I', '--snippet-type'
|
63
|
+
PROFILE_SHORT_FLAG, PROFILE_LONG_FLAG, RETRY_FLAG, RETRY_TOTAL_FLAG,
|
64
|
+
'-l', '--lines', '--port', '-I', '--snippet-type'
|
64
65
|
].freeze
|
65
66
|
ORDER_TYPES = %w[defined random].freeze
|
66
|
-
TAG_LIMIT_MATCHER = /(?<tag_name>@\w+):(?<limit>\d+)/x
|
67
|
+
TAG_LIMIT_MATCHER = /(?<tag_name>@\w+):(?<limit>\d+)/x.freeze
|
67
68
|
|
68
69
|
def self.parse(args, out_stream, error_stream, options = {})
|
69
70
|
new(out_stream, error_stream, options).parse!(args)
|
@@ -108,6 +109,7 @@ module Cucumber
|
|
108
109
|
opts.on('-j DIR', '--jars DIR', 'Load all the jars under DIR') { |jars| load_jars(jars) } if Cucumber::JRUBY
|
109
110
|
|
110
111
|
opts.on("#{RETRY_FLAG} ATTEMPTS", *retry_msg) { |v| set_option :retry, v.to_i }
|
112
|
+
opts.on("#{RETRY_TOTAL_FLAG} TESTS", *retry_total_msg) { |v| set_option :retry_total, v.to_i }
|
111
113
|
opts.on('--i18n-languages', *i18n_languages_msg) { list_languages_and_exit }
|
112
114
|
opts.on('--i18n-keywords LANG', *i18n_keywords_msg) { |lang| language lang }
|
113
115
|
opts.on(FAIL_FAST_FLAG, 'Exit immediately following the first failing scenario') { set_option :fail_fast }
|
@@ -271,6 +273,13 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
271
273
|
['Specify the number of times to retry failing tests (default: 0)']
|
272
274
|
end
|
273
275
|
|
276
|
+
def retry_total_msg
|
277
|
+
[
|
278
|
+
'The total number of failing test after which retrying of tests is suspended.',
|
279
|
+
'Example: --retry-total 10 -> Will stop retrying tests after 10 failing tests.'
|
280
|
+
]
|
281
|
+
end
|
282
|
+
|
274
283
|
def name_msg
|
275
284
|
[
|
276
285
|
'Only execute the feature elements which match part of the given name.',
|
@@ -543,6 +552,7 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
543
552
|
end
|
544
553
|
|
545
554
|
@options[:retry] = other_options[:retry] if @options[:retry].zero?
|
555
|
+
@options[:retry_total] = other_options[:retry_total] if @options[:retry_total].infinite?
|
546
556
|
|
547
557
|
self
|
548
558
|
end
|
@@ -616,7 +626,8 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
616
626
|
snippets: true,
|
617
627
|
source: true,
|
618
628
|
duration: true,
|
619
|
-
retry: 0
|
629
|
+
retry: 0,
|
630
|
+
retry_total: Float::INFINITY
|
620
631
|
}
|
621
632
|
end
|
622
633
|
end
|
@@ -78,6 +78,10 @@ module Cucumber
|
|
78
78
|
@options[:retry]
|
79
79
|
end
|
80
80
|
|
81
|
+
def retry_total_tests
|
82
|
+
@options[:retry_total]
|
83
|
+
end
|
84
|
+
|
81
85
|
def guess?
|
82
86
|
@options[:guess]
|
83
87
|
end
|
@@ -273,7 +277,8 @@ module Cucumber
|
|
273
277
|
snippets: true,
|
274
278
|
source: true,
|
275
279
|
duration: true,
|
276
|
-
event_bus: Cucumber::Events.make_event_bus
|
280
|
+
event_bus: Cucumber::Events.make_event_bus,
|
281
|
+
retry_total: Float::INFINITY
|
277
282
|
}
|
278
283
|
end
|
279
284
|
|
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")
|
@@ -7,6 +7,11 @@ require 'cucumber/events'
|
|
7
7
|
module Cucumber
|
8
8
|
module Filters
|
9
9
|
class Retry < Core::Filter.new(:configuration)
|
10
|
+
def initialize(*_args)
|
11
|
+
super
|
12
|
+
@total_permanently_failed = 0
|
13
|
+
end
|
14
|
+
|
10
15
|
def test_case(test_case)
|
11
16
|
configuration.on_event(:test_case_finished) do |event|
|
12
17
|
next unless retry_required?(test_case, event)
|
@@ -21,7 +26,21 @@ module Cucumber
|
|
21
26
|
private
|
22
27
|
|
23
28
|
def retry_required?(test_case, event)
|
24
|
-
|
29
|
+
return false unless event.test_case == test_case
|
30
|
+
|
31
|
+
return false unless event.result.failed?
|
32
|
+
|
33
|
+
return false if @total_permanently_failed >= configuration.retry_total_tests
|
34
|
+
|
35
|
+
retry_required = test_case_counts[test_case] < configuration.retry_attempts
|
36
|
+
if retry_required
|
37
|
+
# retry test
|
38
|
+
true
|
39
|
+
else
|
40
|
+
# test failed after max. attempts
|
41
|
+
@total_permanently_failed += 1
|
42
|
+
false
|
43
|
+
end
|
25
44
|
end
|
26
45
|
|
27
46
|
def test_case_counts
|
@@ -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}."
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'cucumber/gherkin/formatter/ansi_escapes'
|
4
4
|
require 'cucumber/core/test/data_table'
|
5
5
|
require 'cucumber/deprecate'
|
6
|
-
require '
|
6
|
+
require 'mini_mime'
|
7
7
|
|
8
8
|
module Cucumber
|
9
9
|
module Glue
|
@@ -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
|
@@ -92,7 +92,7 @@ module Cucumber
|
|
92
92
|
return super unless File.file?(file)
|
93
93
|
|
94
94
|
content = File.read(file, mode: 'rb')
|
95
|
-
media_type =
|
95
|
+
media_type = MiniMime.lookup_by_filename(file)&.content_type if media_type.nil?
|
96
96
|
|
97
97
|
super(content, media_type.to_s)
|
98
98
|
rescue StandardError
|
@@ -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
|