cucumber 9.1.0 → 9.1.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/VERSION +1 -1
- data/lib/cucumber/cli/main.rb +1 -1
- data/lib/cucumber/cli/options.rb +37 -37
- data/lib/cucumber/cli/profile_loader.rb +5 -5
- data/lib/cucumber/configuration.rb +1 -1
- data/lib/cucumber/formatter/ansicolor.rb +18 -26
- data/lib/cucumber/formatter/console.rb +7 -7
- data/lib/cucumber/formatter/json.rb +1 -5
- data/lib/cucumber/formatter/junit.rb +1 -1
- data/lib/cucumber/formatter/message_builder.rb +5 -1
- data/lib/cucumber/formatter/pretty.rb +1 -1
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +19 -20
- data/lib/cucumber/glue/invoke_in_world.rb +1 -1
- data/lib/cucumber/multiline_argument/data_table.rb +32 -33
- data/lib/cucumber/running_test_case.rb +1 -1
- data/lib/cucumber/runtime.rb +1 -1
- metadata +25 -163
- data/lib/autotest/cucumber.rb +0 -8
- data/lib/autotest/cucumber_mixin.rb +0 -133
- data/lib/autotest/cucumber_rails.rb +0 -8
- data/lib/autotest/cucumber_rails_rspec.rb +0 -8
- data/lib/autotest/cucumber_rails_rspec2.rb +0 -8
- data/lib/autotest/cucumber_rspec.rb +0 -8
- data/lib/autotest/cucumber_rspec2.rb +0 -8
- data/lib/autotest/discover.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d937b723774ea37f4739f86d3888163faec44b5e815b344c3cb7c8cd2dae8b42
|
4
|
+
data.tar.gz: e7cc47f9e50d7d355baacc10594db8e93b7a3dc961a8b43417c21e11a664929d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 104816fd17fed2d4302d43ecfe1d72465a0b863cf79f449ecc44c25bcc6fe8c00824f0f07014fa0b3986f1476f3ab490c5bb36f9f6b9676715e342682d4c3c40
|
7
|
+
data.tar.gz: 06cdb6fd33a1347415e85590658a0972243798bf653eb3b2a23bc65b5d2d25fccf39b48e85024d2b58ad3868d86f05630a77c719dd6b244def9741eb04736ced
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
9.1.
|
1
|
+
9.1.2
|
data/lib/cucumber/cli/main.rb
CHANGED
@@ -49,7 +49,7 @@ module Cucumber
|
|
49
49
|
rescue Errno::EACCES, Errno::ENOENT => e
|
50
50
|
@err.puts("#{e.message} (#{e.class})")
|
51
51
|
exit_unable_to_finish
|
52
|
-
rescue Exception => e
|
52
|
+
rescue Exception => e
|
53
53
|
@err.puts("#{e.message} (#{e.class})")
|
54
54
|
@err.puts(e.backtrace.join("\n"))
|
55
55
|
exit_unable_to_finish
|
data/lib/cucumber/cli/options.rb
CHANGED
@@ -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'
|
16
|
-
'progress'
|
17
|
-
'rerun'
|
18
|
-
'usage'
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
'stepdefs'
|
24
|
-
|
25
|
-
'junit'
|
26
|
-
|
27
|
-
'json'
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
'message'
|
33
|
-
'html'
|
34
|
-
'summary'
|
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 = [
|
@@ -92,13 +92,13 @@ module Cucumber
|
|
92
92
|
@options[key] = value
|
93
93
|
end
|
94
94
|
|
95
|
-
def parse!(args)
|
95
|
+
def parse!(args)
|
96
96
|
@args = args
|
97
97
|
@expanded_args = @args.dup
|
98
98
|
|
99
99
|
@args.extend(::OptionParser::Arguable)
|
100
100
|
|
101
|
-
@args.options do |opts|
|
101
|
+
@args.options do |opts|
|
102
102
|
opts.banner = banner
|
103
103
|
opts.on('--publish', 'Publish a report to https://reports.cucumber.io') do
|
104
104
|
set_option :publish_enabled, true
|
@@ -143,11 +143,11 @@ module Cucumber
|
|
143
143
|
opts.on('-x', '--expand', 'Expand Scenario Outline Tables in output.') { set_option :expand }
|
144
144
|
|
145
145
|
opts.on('--order TYPE[:SEED]', 'Run examples in the specified order. Available types:',
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
Specify SEED to reproduce the shuffling from a previous run.
|
150
|
-
|
146
|
+
*<<~TEXT.split("\n")) do |order|
|
147
|
+
[defined] Run scenarios in the order they were defined (default).
|
148
|
+
[random] Shuffle scenarios before running.
|
149
|
+
Specify SEED to reproduce the shuffling from a previous run.
|
150
|
+
e.g. --order random:5738
|
151
151
|
TEXT
|
152
152
|
@options[:order], @options[:seed] = *order.split(':')
|
153
153
|
raise "'#{@options[:order]}' is not a recognised order type. Please use one of #{ORDER_TYPES.join(', ')}." unless ORDER_TYPES.include?(@options[:order])
|
@@ -295,9 +295,9 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
295
295
|
]
|
296
296
|
end
|
297
297
|
|
298
|
-
def parse_formats(
|
299
|
-
formatter, *formatter_options =
|
300
|
-
options_hash = Hash[formatter_options.map { |
|
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
|
|
@@ -375,12 +375,12 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
375
375
|
].join("\n")
|
376
376
|
end
|
377
377
|
|
378
|
-
def require_files(
|
379
|
-
@options[:require] <<
|
380
|
-
return unless Cucumber::JRUBY && File.directory?(
|
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 <<
|
383
|
+
$CLASSPATH << filenames
|
384
384
|
end
|
385
385
|
|
386
386
|
def require_jars(jars)
|
@@ -441,8 +441,8 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
441
441
|
ProjectInitializer.new.run && Kernel.exit(0)
|
442
442
|
end
|
443
443
|
|
444
|
-
def add_profile(
|
445
|
-
@profiles <<
|
444
|
+
def add_profile(profile)
|
445
|
+
@profiles << profile
|
446
446
|
end
|
447
447
|
|
448
448
|
def set_option(option, value = nil)
|
@@ -522,7 +522,7 @@ Specify SEED to reproduce the shuffling from a previous run.
|
|
522
522
|
@profile_loader ||= ProfileLoader.new
|
523
523
|
end
|
524
524
|
|
525
|
-
def reverse_merge(other_options)
|
525
|
+
def reverse_merge(other_options)
|
526
526
|
@options = other_options.options.merge(@options)
|
527
527
|
@options[:require] += other_options[:require]
|
528
528
|
@options[:excludes] += other_options[:excludes]
|
@@ -11,11 +11,11 @@ module Cucumber
|
|
11
11
|
|
12
12
|
def args_from(profile)
|
13
13
|
unless cucumber_yml.key?(profile)
|
14
|
-
raise(ProfileNotFound,
|
15
|
-
Could not find profile: '#{profile}'
|
14
|
+
raise(ProfileNotFound, <<~END_OF_ERROR)
|
15
|
+
Could not find profile: '#{profile}'
|
16
16
|
|
17
|
-
Defined profiles in cucumber.yml:
|
18
|
-
|
17
|
+
Defined profiles in cucumber.yml:
|
18
|
+
* #{cucumber_yml.keys.sort.join("\n * ")}
|
19
19
|
END_OF_ERROR
|
20
20
|
end
|
21
21
|
|
@@ -84,7 +84,7 @@ Defined profiles in cucumber.yml:
|
|
84
84
|
def load_configuration
|
85
85
|
require 'yaml'
|
86
86
|
begin
|
87
|
-
@cucumber_yml = YAML.load(@cucumber_erb)
|
87
|
+
@cucumber_yml = YAML.load(@cucumber_erb)
|
88
88
|
rescue StandardError
|
89
89
|
raise(YmlLoadError, "cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.\n")
|
90
90
|
end
|
@@ -213,7 +213,7 @@ module Cucumber
|
|
213
213
|
yield factory,
|
214
214
|
formatter_options,
|
215
215
|
path_or_io
|
216
|
-
rescue Exception => e
|
216
|
+
rescue Exception => e
|
217
217
|
raise e, "#{e.message}\nError creating formatter: #{format}", e.backtrace
|
218
218
|
end
|
219
219
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'cucumber/platform'
|
4
4
|
require 'cucumber/term/ansicolor'
|
5
5
|
|
6
|
-
Cucumber::Term::ANSIColor.coloring = false
|
6
|
+
Cucumber::Term::ANSIColor.coloring = false unless $stdout.tty?
|
7
7
|
|
8
8
|
module Cucumber
|
9
9
|
module Formatter
|
@@ -63,29 +63,23 @@ 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
|
|
70
69
|
"#{h[Regexp.last_match(1)]},bold"
|
71
70
|
end.merge(
|
72
71
|
'undefined' => 'yellow',
|
73
|
-
'pending'
|
74
|
-
'flaky'
|
75
|
-
'failed'
|
76
|
-
'passed'
|
77
|
-
'outline'
|
78
|
-
'skipped'
|
79
|
-
'comment'
|
80
|
-
'tag'
|
72
|
+
'pending' => 'yellow',
|
73
|
+
'flaky' => 'yellow',
|
74
|
+
'failed' => 'red',
|
75
|
+
'passed' => 'green',
|
76
|
+
'outline' => 'cyan',
|
77
|
+
'skipped' => 'cyan',
|
78
|
+
'comment' => 'grey',
|
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
|
-
|
121
|
-
|
122
|
-
('(::) ' * n).strip
|
114
|
+
def cukes(amount)
|
115
|
+
('(::) ' * amount).strip
|
123
116
|
end
|
124
117
|
|
125
|
-
def green_cukes(
|
126
|
-
blink(green(cukes(
|
118
|
+
def green_cukes(amount)
|
119
|
+
blink(green(cukes(amount)))
|
127
120
|
end
|
128
121
|
|
129
|
-
def red_cukes(
|
130
|
-
blink(red(cukes(
|
122
|
+
def red_cukes(amount)
|
123
|
+
blink(red(cukes(amount)))
|
131
124
|
end
|
132
125
|
|
133
|
-
def yellow_cukes(
|
134
|
-
blink(yellow(cukes(
|
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(
|
46
|
+
def format_string(input, status)
|
47
47
|
fmt = format_for(status)
|
48
|
-
|
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(
|
96
|
-
string = exception_message_string(
|
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(
|
101
|
-
message = "#{
|
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#{
|
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
|
@@ -102,7 +102,7 @@ module Cucumber
|
|
102
102
|
private
|
103
103
|
|
104
104
|
def same_feature_as_previous_test_case?(test_case)
|
105
|
-
|
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 ||= {} # rubocop:disable Naming/MemoizedInstanceVariableName
|
118
|
-
end
|
119
|
-
|
120
116
|
def feature_elements
|
121
117
|
@feature_hash[:elements] ||= []
|
122
118
|
end
|
@@ -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
|
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(
|
@@ -395,7 +395,7 @@ module Cucumber
|
|
395
395
|
end
|
396
396
|
end
|
397
397
|
|
398
|
-
def print_outline_data(scenario_outline)
|
398
|
+
def print_outline_data(scenario_outline)
|
399
399
|
print_comments(scenario_outline.location.line, 2)
|
400
400
|
print_tags(scenario_outline.tags, 2)
|
401
401
|
@source_indent = calculate_source_indent_for_ast_node(scenario_outline) if options[:source]
|
@@ -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
|
#
|
@@ -41,30 +40,30 @@ module Cucumber
|
|
41
40
|
# Although not listed, you can also use <tt>grey</tt>
|
42
41
|
module AnsiEscapes
|
43
42
|
COLORS = {
|
44
|
-
'black'
|
45
|
-
'red'
|
46
|
-
'green'
|
47
|
-
'yellow'
|
48
|
-
'blue'
|
43
|
+
'black' => "\e[30m",
|
44
|
+
'red' => "\e[31m",
|
45
|
+
'green' => "\e[32m",
|
46
|
+
'yellow' => "\e[33m",
|
47
|
+
'blue' => "\e[34m",
|
49
48
|
'magenta' => "\e[35m",
|
50
|
-
'cyan'
|
51
|
-
'white'
|
52
|
-
'grey'
|
53
|
-
'bold'
|
49
|
+
'cyan' => "\e[36m",
|
50
|
+
'white' => "\e[37m",
|
51
|
+
'grey' => "\e[90m",
|
52
|
+
'bold' => "\e[1m"
|
54
53
|
}.freeze
|
55
54
|
|
56
55
|
ALIASES = Hash.new do |h, k|
|
57
56
|
"#{h[Regexp.last_match(1)]},bold" if k.to_s =~ /(.*)_arg/
|
58
57
|
end.merge(
|
59
58
|
'undefined' => 'yellow',
|
60
|
-
'pending'
|
59
|
+
'pending' => 'yellow',
|
61
60
|
'executing' => 'grey',
|
62
|
-
'failed'
|
63
|
-
'passed'
|
64
|
-
'outline'
|
65
|
-
'skipped'
|
66
|
-
'comments'
|
67
|
-
'tag'
|
61
|
+
'failed' => 'red',
|
62
|
+
'passed' => 'green',
|
63
|
+
'outline' => 'cyan',
|
64
|
+
'skipped' => 'cyan',
|
65
|
+
'comments' => 'grey',
|
66
|
+
'tag' => 'cyan'
|
68
67
|
)
|
69
68
|
|
70
69
|
# Example: export GHERKIN_COLORS="passed=red:failed=yellow"
|
@@ -87,8 +86,8 @@ module Cucumber
|
|
87
86
|
"\e[0m"
|
88
87
|
end
|
89
88
|
|
90
|
-
def up(
|
91
|
-
"\e[#{
|
89
|
+
def up(amount)
|
90
|
+
"\e[#{amount}A"
|
92
91
|
end
|
93
92
|
end
|
94
93
|
end
|
@@ -48,7 +48,7 @@ module Cucumber
|
|
48
48
|
|
49
49
|
def self.cucumber_run_with_backtrace_filtering(pseudo_method)
|
50
50
|
yield
|
51
|
-
rescue Exception => e
|
51
|
+
rescue Exception => e
|
52
52
|
instance_exec_invocation_line = "#{__FILE__}:#{__LINE__ - 2}:in `cucumber_run_with_backtrace_filtering'"
|
53
53
|
replace_instance_exec_invocation_line!((e.backtrace || []), instance_exec_invocation_line, pseudo_method)
|
54
54
|
raise e
|
@@ -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
|
|
@@ -194,17 +194,17 @@ module Cucumber
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
-
def column_names
|
197
|
+
def column_names
|
198
198
|
@column_names ||= cell_matrix[0].map(&:value)
|
199
199
|
end
|
200
200
|
|
201
201
|
def rows
|
202
202
|
hashes.map do |hash|
|
203
|
-
hash.values_at
|
203
|
+
hash.values_at(*headers)
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
-
def each_cells_row(&proc)
|
207
|
+
def each_cells_row(&proc)
|
208
208
|
cells_rows.each(&proc)
|
209
209
|
end
|
210
210
|
|
@@ -340,7 +340,7 @@ module Cucumber
|
|
340
340
|
cells_rows.map { |cells| cells.map(&:value) }
|
341
341
|
end
|
342
342
|
|
343
|
-
def cells_to_hash(cells)
|
343
|
+
def cells_to_hash(cells)
|
344
344
|
hash = Hash.new do |hash_inner, key|
|
345
345
|
hash_inner[key.to_s] if key.is_a?(Symbol)
|
346
346
|
end
|
@@ -350,51 +350,51 @@ module Cucumber
|
|
350
350
|
hash
|
351
351
|
end
|
352
352
|
|
353
|
-
def index(cells)
|
353
|
+
def index(cells)
|
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
|
|
365
365
|
# TODO: remove the below function if it's not actually being used.
|
366
366
|
# Nothing else in this repo calls it.
|
367
|
-
def text?(text)
|
367
|
+
def text?(text)
|
368
368
|
raw.flatten.compact.detect { |cell_value| cell_value.index(text) }
|
369
369
|
end
|
370
370
|
|
371
|
-
def cells_rows
|
372
|
-
@rows ||= cell_matrix.map do |cell_row|
|
371
|
+
def cells_rows
|
372
|
+
@rows ||= cell_matrix.map do |cell_row|
|
373
373
|
Cells.new(self, cell_row)
|
374
374
|
end
|
375
375
|
end
|
376
376
|
|
377
|
-
def headers
|
377
|
+
def headers
|
378
378
|
raw.first
|
379
379
|
end
|
380
380
|
|
381
|
-
def header_cell(col)
|
381
|
+
def header_cell(col)
|
382
382
|
cells_rows[0][col]
|
383
383
|
end
|
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
|
-
|
540
|
-
def to_sexp # :nodoc:
|
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(
|
549
|
-
self[
|
547
|
+
def value(index)
|
548
|
+
self[index].value
|
550
549
|
end
|
551
550
|
|
552
|
-
def [](
|
553
|
-
@cells[
|
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
|
data/lib/cucumber/runtime.rb
CHANGED
@@ -235,7 +235,7 @@ module Cucumber
|
|
235
235
|
end
|
236
236
|
|
237
237
|
require 'cucumber/core/test/filters'
|
238
|
-
def filters
|
238
|
+
def filters
|
239
239
|
tag_expressions = @configuration.tag_expressions
|
240
240
|
name_regexps = @configuration.name_regexps
|
241
241
|
tag_limits = @configuration.tag_limits
|
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.
|
4
|
+
version: 9.1.2
|
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:
|
13
|
+
date: 2024-01-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: builder
|
@@ -84,7 +84,7 @@ dependencies:
|
|
84
84
|
name: cucumber-gherkin
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '24'
|
90
90
|
- - "<"
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- - "
|
97
|
+
- - ">"
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '24'
|
100
100
|
- - "<"
|
@@ -104,42 +104,42 @@ dependencies:
|
|
104
104
|
name: cucumber-html-formatter
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "
|
107
|
+
- - ">"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '20.
|
110
|
-
- - "
|
109
|
+
version: '20.3'
|
110
|
+
- - "<"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: '22'
|
113
113
|
type: :runtime
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- - "
|
117
|
+
- - ">"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: '20.
|
120
|
-
- - "
|
119
|
+
version: '20.3'
|
120
|
+
- - "<"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
122
|
+
version: '22'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: cucumber-messages
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - "
|
127
|
+
- - ">"
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '19'
|
130
130
|
- - "<"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '
|
132
|
+
version: '25'
|
133
133
|
type: :runtime
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - "
|
137
|
+
- - ">"
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '19'
|
140
140
|
- - "<"
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
142
|
+
version: '25'
|
143
143
|
- !ruby/object:Gem::Dependency
|
144
144
|
name: diff-lcs
|
145
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,9 +147,6 @@ dependencies:
|
|
147
147
|
- - "~>"
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '1.5'
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 1.5.0
|
153
150
|
type: :runtime
|
154
151
|
prerelease: false
|
155
152
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -157,9 +154,6 @@ dependencies:
|
|
157
154
|
- - "~>"
|
158
155
|
- !ruby/object:Gem::Version
|
159
156
|
version: '1.5'
|
160
|
-
- - ">="
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version: 1.5.0
|
163
157
|
- !ruby/object:Gem::Dependency
|
164
158
|
name: mini_mime
|
165
159
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,54 +220,42 @@ dependencies:
|
|
226
220
|
requirements:
|
227
221
|
- - "~>"
|
228
222
|
- !ruby/object:Gem::Version
|
229
|
-
version: '
|
223
|
+
version: '15.0'
|
230
224
|
type: :development
|
231
225
|
prerelease: false
|
232
226
|
version_requirements: !ruby/object:Gem::Requirement
|
233
227
|
requirements:
|
234
228
|
- - "~>"
|
235
229
|
- !ruby/object:Gem::Version
|
236
|
-
version: '
|
230
|
+
version: '15.0'
|
237
231
|
- !ruby/object:Gem::Dependency
|
238
232
|
name: nokogiri
|
239
233
|
requirement: !ruby/object:Gem::Requirement
|
240
234
|
requirements:
|
241
235
|
- - "~>"
|
242
236
|
- !ruby/object:Gem::Version
|
243
|
-
version: '1.
|
244
|
-
- - ">="
|
245
|
-
- !ruby/object:Gem::Version
|
246
|
-
version: 1.13.6
|
237
|
+
version: '1.14'
|
247
238
|
type: :development
|
248
239
|
prerelease: false
|
249
240
|
version_requirements: !ruby/object:Gem::Requirement
|
250
241
|
requirements:
|
251
242
|
- - "~>"
|
252
243
|
- !ruby/object:Gem::Version
|
253
|
-
version: '1.
|
254
|
-
- - ">="
|
255
|
-
- !ruby/object:Gem::Version
|
256
|
-
version: 1.13.6
|
244
|
+
version: '1.14'
|
257
245
|
- !ruby/object:Gem::Dependency
|
258
246
|
name: rake
|
259
247
|
requirement: !ruby/object:Gem::Requirement
|
260
248
|
requirements:
|
261
249
|
- - "~>"
|
262
250
|
- !ruby/object:Gem::Version
|
263
|
-
version: '13.
|
264
|
-
- - ">="
|
265
|
-
- !ruby/object:Gem::Version
|
266
|
-
version: 13.0.6
|
251
|
+
version: '13.1'
|
267
252
|
type: :development
|
268
253
|
prerelease: false
|
269
254
|
version_requirements: !ruby/object:Gem::Requirement
|
270
255
|
requirements:
|
271
256
|
- - "~>"
|
272
257
|
- !ruby/object:Gem::Version
|
273
|
-
version: '13.
|
274
|
-
- - ">="
|
275
|
-
- !ruby/object:Gem::Version
|
276
|
-
version: 13.0.6
|
258
|
+
version: '13.1'
|
277
259
|
- !ruby/object:Gem::Dependency
|
278
260
|
name: rspec
|
279
261
|
requirement: !ruby/object:Gem::Requirement
|
@@ -281,9 +263,6 @@ dependencies:
|
|
281
263
|
- - "~>"
|
282
264
|
- !ruby/object:Gem::Version
|
283
265
|
version: '3.12'
|
284
|
-
- - ">="
|
285
|
-
- !ruby/object:Gem::Version
|
286
|
-
version: 3.12.0
|
287
266
|
type: :development
|
288
267
|
prerelease: false
|
289
268
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -291,9 +270,6 @@ dependencies:
|
|
291
270
|
- - "~>"
|
292
271
|
- !ruby/object:Gem::Version
|
293
272
|
version: '3.12'
|
294
|
-
- - ">="
|
295
|
-
- !ruby/object:Gem::Version
|
296
|
-
version: 3.12.0
|
297
273
|
- !ruby/object:Gem::Dependency
|
298
274
|
name: rubocop
|
299
275
|
requirement: !ruby/object:Gem::Requirement
|
@@ -356,14 +332,14 @@ dependencies:
|
|
356
332
|
requirements:
|
357
333
|
- - "~>"
|
358
334
|
- !ruby/object:Gem::Version
|
359
|
-
version: 2.
|
335
|
+
version: 2.25.0
|
360
336
|
type: :development
|
361
337
|
prerelease: false
|
362
338
|
version_requirements: !ruby/object:Gem::Requirement
|
363
339
|
requirements:
|
364
340
|
- - "~>"
|
365
341
|
- !ruby/object:Gem::Version
|
366
|
-
version: 2.
|
342
|
+
version: 2.25.0
|
367
343
|
- !ruby/object:Gem::Dependency
|
368
344
|
name: simplecov
|
369
345
|
requirement: !ruby/object:Gem::Requirement
|
@@ -378,46 +354,6 @@ dependencies:
|
|
378
354
|
- - "~>"
|
379
355
|
- !ruby/object:Gem::Version
|
380
356
|
version: 0.22.0
|
381
|
-
- !ruby/object:Gem::Dependency
|
382
|
-
name: syntax
|
383
|
-
requirement: !ruby/object:Gem::Requirement
|
384
|
-
requirements:
|
385
|
-
- - "~>"
|
386
|
-
- !ruby/object:Gem::Version
|
387
|
-
version: '1.2'
|
388
|
-
- - ">="
|
389
|
-
- !ruby/object:Gem::Version
|
390
|
-
version: 1.2.2
|
391
|
-
type: :development
|
392
|
-
prerelease: false
|
393
|
-
version_requirements: !ruby/object:Gem::Requirement
|
394
|
-
requirements:
|
395
|
-
- - "~>"
|
396
|
-
- !ruby/object:Gem::Version
|
397
|
-
version: '1.2'
|
398
|
-
- - ">="
|
399
|
-
- !ruby/object:Gem::Version
|
400
|
-
version: 1.2.2
|
401
|
-
- !ruby/object:Gem::Dependency
|
402
|
-
name: test-unit
|
403
|
-
requirement: !ruby/object:Gem::Requirement
|
404
|
-
requirements:
|
405
|
-
- - "~>"
|
406
|
-
- !ruby/object:Gem::Version
|
407
|
-
version: '3.6'
|
408
|
-
- - ">="
|
409
|
-
- !ruby/object:Gem::Version
|
410
|
-
version: 3.6.1
|
411
|
-
type: :development
|
412
|
-
prerelease: false
|
413
|
-
version_requirements: !ruby/object:Gem::Requirement
|
414
|
-
requirements:
|
415
|
-
- - "~>"
|
416
|
-
- !ruby/object:Gem::Version
|
417
|
-
version: '3.6'
|
418
|
-
- - ">="
|
419
|
-
- !ruby/object:Gem::Version
|
420
|
-
version: 3.6.1
|
421
357
|
- !ruby/object:Gem::Dependency
|
422
358
|
name: webrick
|
423
359
|
requirement: !ruby/object:Gem::Requirement
|
@@ -425,9 +361,6 @@ dependencies:
|
|
425
361
|
- - "~>"
|
426
362
|
- !ruby/object:Gem::Version
|
427
363
|
version: '1.8'
|
428
|
-
- - ">="
|
429
|
-
- !ruby/object:Gem::Version
|
430
|
-
version: 1.8.1
|
431
364
|
type: :development
|
432
365
|
prerelease: false
|
433
366
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -435,69 +368,6 @@ dependencies:
|
|
435
368
|
- - "~>"
|
436
369
|
- !ruby/object:Gem::Version
|
437
370
|
version: '1.8'
|
438
|
-
- - ">="
|
439
|
-
- !ruby/object:Gem::Version
|
440
|
-
version: 1.8.1
|
441
|
-
- !ruby/object:Gem::Dependency
|
442
|
-
name: capybara
|
443
|
-
requirement: !ruby/object:Gem::Requirement
|
444
|
-
requirements:
|
445
|
-
- - "~>"
|
446
|
-
- !ruby/object:Gem::Version
|
447
|
-
version: '3.39'
|
448
|
-
- - ">="
|
449
|
-
- !ruby/object:Gem::Version
|
450
|
-
version: 3.39.2
|
451
|
-
type: :development
|
452
|
-
prerelease: false
|
453
|
-
version_requirements: !ruby/object:Gem::Requirement
|
454
|
-
requirements:
|
455
|
-
- - "~>"
|
456
|
-
- !ruby/object:Gem::Version
|
457
|
-
version: '3.39'
|
458
|
-
- - ">="
|
459
|
-
- !ruby/object:Gem::Version
|
460
|
-
version: 3.39.2
|
461
|
-
- !ruby/object:Gem::Dependency
|
462
|
-
name: rack-test
|
463
|
-
requirement: !ruby/object:Gem::Requirement
|
464
|
-
requirements:
|
465
|
-
- - "~>"
|
466
|
-
- !ruby/object:Gem::Version
|
467
|
-
version: '2.1'
|
468
|
-
- - ">="
|
469
|
-
- !ruby/object:Gem::Version
|
470
|
-
version: 2.1.0
|
471
|
-
type: :development
|
472
|
-
prerelease: false
|
473
|
-
version_requirements: !ruby/object:Gem::Requirement
|
474
|
-
requirements:
|
475
|
-
- - "~>"
|
476
|
-
- !ruby/object:Gem::Version
|
477
|
-
version: '2.1'
|
478
|
-
- - ">="
|
479
|
-
- !ruby/object:Gem::Version
|
480
|
-
version: 2.1.0
|
481
|
-
- !ruby/object:Gem::Dependency
|
482
|
-
name: sinatra
|
483
|
-
requirement: !ruby/object:Gem::Requirement
|
484
|
-
requirements:
|
485
|
-
- - "~>"
|
486
|
-
- !ruby/object:Gem::Version
|
487
|
-
version: '3.1'
|
488
|
-
- - ">="
|
489
|
-
- !ruby/object:Gem::Version
|
490
|
-
version: 3.1.0
|
491
|
-
type: :development
|
492
|
-
prerelease: false
|
493
|
-
version_requirements: !ruby/object:Gem::Requirement
|
494
|
-
requirements:
|
495
|
-
- - "~>"
|
496
|
-
- !ruby/object:Gem::Version
|
497
|
-
version: '3.1'
|
498
|
-
- - ">="
|
499
|
-
- !ruby/object:Gem::Version
|
500
|
-
version: 3.1.0
|
501
371
|
description: Behaviour Driven Development with elegance and joy
|
502
372
|
email: cukes@googlegroups.com
|
503
373
|
executables:
|
@@ -509,14 +379,6 @@ files:
|
|
509
379
|
- README.md
|
510
380
|
- VERSION
|
511
381
|
- bin/cucumber
|
512
|
-
- lib/autotest/cucumber.rb
|
513
|
-
- lib/autotest/cucumber_mixin.rb
|
514
|
-
- lib/autotest/cucumber_rails.rb
|
515
|
-
- lib/autotest/cucumber_rails_rspec.rb
|
516
|
-
- lib/autotest/cucumber_rails_rspec2.rb
|
517
|
-
- lib/autotest/cucumber_rspec.rb
|
518
|
-
- lib/autotest/cucumber_rspec2.rb
|
519
|
-
- lib/autotest/discover.rb
|
520
382
|
- lib/cucumber.rb
|
521
383
|
- lib/cucumber/cli/configuration.rb
|
522
384
|
- lib/cucumber/cli/main.rb
|
@@ -667,5 +529,5 @@ requirements: []
|
|
667
529
|
rubygems_version: 3.3.5
|
668
530
|
signing_key:
|
669
531
|
specification_version: 4
|
670
|
-
summary: cucumber-9.1.
|
532
|
+
summary: cucumber-9.1.2
|
671
533
|
test_files: []
|
data/lib/autotest/cucumber.rb
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'autotest'
|
4
|
-
require 'tempfile'
|
5
|
-
require 'cucumber'
|
6
|
-
require 'cucumber/cli/profile_loader'
|
7
|
-
|
8
|
-
module Autotest::CucumberMixin
|
9
|
-
def self.included(receiver)
|
10
|
-
receiver::ALL_HOOKS << %i[run_features ran_features]
|
11
|
-
end
|
12
|
-
|
13
|
-
attr_accessor :features_to_run
|
14
|
-
|
15
|
-
def initialize
|
16
|
-
super
|
17
|
-
reset_features
|
18
|
-
end
|
19
|
-
|
20
|
-
def run
|
21
|
-
hook :initialize
|
22
|
-
reset
|
23
|
-
reset_features
|
24
|
-
add_sigint_handler
|
25
|
-
|
26
|
-
loop do # ^c handler
|
27
|
-
wait_for_green
|
28
|
-
if tainted
|
29
|
-
rerun_all_tests
|
30
|
-
rerun_all_features if all_good
|
31
|
-
else
|
32
|
-
hook :all_good
|
33
|
-
end
|
34
|
-
wait_for_changes
|
35
|
-
# Once tests and features are green, reset features every
|
36
|
-
# time a file is changed to see if anything breaks.
|
37
|
-
reset_features
|
38
|
-
rescue Interrupt
|
39
|
-
break if wants_to_quit
|
40
|
-
|
41
|
-
reset
|
42
|
-
reset_features
|
43
|
-
end
|
44
|
-
hook :quit
|
45
|
-
end
|
46
|
-
|
47
|
-
def all_features_good
|
48
|
-
features_to_run == ''
|
49
|
-
end
|
50
|
-
|
51
|
-
def wait_for_green
|
52
|
-
loop do
|
53
|
-
super
|
54
|
-
run_features
|
55
|
-
wait_for_changes unless all_features_good
|
56
|
-
break if all_features_good
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def rerun_all_features
|
61
|
-
reset_features
|
62
|
-
run_features
|
63
|
-
end
|
64
|
-
|
65
|
-
def reset_features
|
66
|
-
self.features_to_run = :all
|
67
|
-
end
|
68
|
-
|
69
|
-
def run_features
|
70
|
-
hook :run_features
|
71
|
-
Tempfile.open('autotest-cucumber') do |dirty_features_file|
|
72
|
-
cmd = make_cucumber_cmd(features_to_run, dirty_features_file.path)
|
73
|
-
break if cmd.empty?
|
74
|
-
|
75
|
-
old_sync = $stdout.sync
|
76
|
-
$stdout.sync = true
|
77
|
-
self.results = []
|
78
|
-
line = []
|
79
|
-
begin
|
80
|
-
open("| #{cmd}", 'r') do |f| # rubocop:disable Security/Open
|
81
|
-
until f.eof?
|
82
|
-
c = f.getc || break
|
83
|
-
print(c)
|
84
|
-
line << c
|
85
|
-
next unless c == "\n"
|
86
|
-
|
87
|
-
results << line.join
|
88
|
-
line.clear
|
89
|
-
end
|
90
|
-
end
|
91
|
-
ensure
|
92
|
-
$stdout.sync = old_sync
|
93
|
-
end
|
94
|
-
self.features_to_run = dirty_features_file.read.strip
|
95
|
-
self.tainted = true unless features_to_run == ''
|
96
|
-
end
|
97
|
-
hook :ran_features
|
98
|
-
end
|
99
|
-
|
100
|
-
def make_cucumber_cmd(features_to_run, _dirty_features_filename)
|
101
|
-
return '' if features_to_run.empty?
|
102
|
-
|
103
|
-
profile_loader = Cucumber::Cli::ProfileLoader.new
|
104
|
-
|
105
|
-
profile = profile(profile_loader)
|
106
|
-
|
107
|
-
args = created_args(features_to_run, profile)
|
108
|
-
|
109
|
-
"#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} #{args}"
|
110
|
-
end
|
111
|
-
|
112
|
-
def profile(profile_loader)
|
113
|
-
profile ||= 'autotest-all' if profile_loader.profile?('autotest-all') && features_to_run == :all
|
114
|
-
profile ||= 'autotest' if profile_loader.profile?('autotest')
|
115
|
-
profile || nil
|
116
|
-
end
|
117
|
-
|
118
|
-
def created_args(features_to_run, profile)
|
119
|
-
args = if profile
|
120
|
-
['--profile', profile]
|
121
|
-
else
|
122
|
-
%w[--format] << (features_to_run == :all ? 'progress' : 'pretty')
|
123
|
-
end
|
124
|
-
# No --color option as some IDEs (Netbeans) don't output them very well ([31m1 failed step[0m)
|
125
|
-
args += %w[--format rerun --out] << dirty_features_filename
|
126
|
-
args << (features_to_run == :all ? '' : features_to_run)
|
127
|
-
|
128
|
-
# All steps becom undefined during rerun unless the following is run.
|
129
|
-
args << 'features/step_definitions' << 'features/support' unless features_to_run == :all
|
130
|
-
|
131
|
-
args.join(' ')
|
132
|
-
end
|
133
|
-
end
|
data/lib/autotest/discover.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Autotest.add_discovery do
|
4
|
-
if File.directory?('features')
|
5
|
-
case ENV['AUTOFEATURE']
|
6
|
-
when /true/i
|
7
|
-
'cucumber'
|
8
|
-
when /false/i
|
9
|
-
# noop
|
10
|
-
else
|
11
|
-
puts '(Not running features. To run features in autotest, set AUTOFEATURE=true.)'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|