cucumber-core 7.0.0 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +61 -0
- data/CONTRIBUTING.md +3 -3
- data/README.md +2 -2
- data/lib/cucumber/core/compiler.rb +3 -3
- data/lib/cucumber/core/event.rb +3 -3
- data/lib/cucumber/core/event_bus.rb +1 -1
- data/lib/cucumber/core/events.rb +0 -1
- data/lib/cucumber/core/gherkin/writer.rb +15 -5
- data/lib/cucumber/core/gherkin/writer/helpers.rb +2 -2
- data/lib/cucumber/core/report/summary.rb +1 -1
- data/lib/cucumber/core/test/action.rb +1 -2
- data/lib/cucumber/core/test/data_table.rb +1 -1
- data/lib/cucumber/core/test/filters/activate_steps_for_self_test.rb +0 -1
- data/lib/cucumber/core/test/result.rb +27 -18
- data/lib/cucumber/core/test/timer.rb +2 -2
- data/lib/cucumber/core/version.rb +1 -1
- data/spec/coverage.rb +1 -0
- data/spec/cucumber/core/compiler_spec.rb +1 -1
- data/spec/cucumber/core/event_bus_spec.rb +2 -2
- data/spec/cucumber/core/event_spec.rb +3 -3
- data/spec/cucumber/core/filter_spec.rb +2 -2
- data/spec/cucumber/core/gherkin/parser_spec.rb +1 -1
- data/spec/cucumber/core/gherkin/writer_spec.rb +0 -1
- data/spec/cucumber/core/report/summary_spec.rb +11 -0
- data/spec/cucumber/core/test/action_spec.rb +1 -2
- data/spec/cucumber/core/test/data_table_spec.rb +6 -6
- data/spec/cucumber/core/test/location_spec.rb +7 -7
- data/spec/cucumber/core/test/result_spec.rb +16 -16
- data/spec/cucumber/core_spec.rb +1 -1
- metadata +81 -63
- data/spec/capture_warnings.rb +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e93409e35ad98842e630d094f02c5f89fd231c91aa8e0cc79084e67f4ef467c8
|
4
|
+
data.tar.gz: c9a191b3e2a2beb0504d961a6c015fb44de6bbef2d5e5979e83682fe4c294771
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1942ec15af9e74b8fd4487cefdd485e6bf8d476a14d4177bdda4d084e515f297696ebe59b2fa5a0535619dc708c355ca147dfd6a764e4a2af8ccc20dda8955ec
|
7
|
+
data.tar.gz: c469d7d0eb04ac6cdacca93153fd17c0d369938b975304063adb1f1552662032b37098d3aa815006afd65c6180d0e964240d6b5e4a45d2752c950fe3c9e2ff60
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,66 @@
|
|
1
1
|
Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) on how to contribute to Cucumber.
|
2
2
|
|
3
|
+
## [In GIT](https://github.com/cucumber/cucumber-ruby-core/compare/v10.0.0...main)
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
### Changed
|
8
|
+
|
9
|
+
### Deprecate
|
10
|
+
|
11
|
+
### Removed
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
### Dependencies
|
16
|
+
|
17
|
+
## [10.0.0](https://github.com/cucumber/cucumber-ruby-core/compare/v9.0.1...v10.0.0)
|
18
|
+
|
19
|
+
### Dependencies
|
20
|
+
|
21
|
+
* Upgraded to gherkin v20 and messages v17.
|
22
|
+
|
23
|
+
This removes protocol buffers from the runtime dependencies.
|
24
|
+
|
25
|
+
This deeply impacts the API as the internal representation of messages has changed from
|
26
|
+
Protocol Buffer objects to new auto-generated DTOs.
|
27
|
+
|
28
|
+
## [9.0.1](https://github.com/cucumber/cucumber-ruby-core/compare/v9.0.0...v9.0.1)
|
29
|
+
|
30
|
+
### Fixed
|
31
|
+
|
32
|
+
* Skipped scenarios do not affect anymore status of flaky scenarios on retry
|
33
|
+
([#218](https://github.com/cucumber/cucumber-ruby-core/pull/218) @eduardrudko)
|
34
|
+
|
35
|
+
## [9.0.0](https://github.com/cucumber/cucumber-ruby-core/compare/v8.0.1...v9.0.0)
|
36
|
+
|
37
|
+
### Dependencies
|
38
|
+
|
39
|
+
* Upgraded to gherkin v18 and messages v15
|
40
|
+
* Updated other dependencies (look at the diff for details)
|
41
|
+
|
42
|
+
## [8.0.1](https://github.com/cucumber/cucumber-ruby-core/compare/v8.0.0...v8.0.1)
|
43
|
+
|
44
|
+
### Fixed
|
45
|
+
|
46
|
+
* Make releases from docker using secrets from keybase
|
47
|
+
|
48
|
+
## [8.0.0](https://github.com/cucumber/cucumber-ruby-core/compare/v7.1.0...v8.0.0)
|
49
|
+
|
50
|
+
This release failed
|
51
|
+
|
52
|
+
### Dependencies
|
53
|
+
|
54
|
+
* Updated dependencies (look at the diff for details)
|
55
|
+
|
56
|
+
## [7.1.0](https://github.com/cucumber/cucumber-ruby-core/compare/v7.0.0...v7.1.0)
|
57
|
+
|
58
|
+
### Changed
|
59
|
+
|
60
|
+
* Updated gems:
|
61
|
+
* `cucumber-gherkin` ~> 14.0.1
|
62
|
+
* `cucumber-messages` ~> 12.2.0
|
63
|
+
|
3
64
|
## [7.0.0](https://github.com/cucumber/cucumber-ruby-core/compare/v6.0.0...v7.0.0)
|
4
65
|
|
5
66
|
### Changed
|
data/CONTRIBUTING.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Release Process
|
2
2
|
===============
|
3
3
|
|
4
|
+
* Upgrade gems with `scripts/update-gemspec`
|
4
5
|
* Bump the version number in `lib/cucumber/core/version.rb`
|
5
6
|
* Update `CHANGELOG.md` with the upcoming version number and create a new `In Git` section
|
7
|
+
* Remove empty sections from `CHANGELOG.md`
|
6
8
|
* Now release it:
|
7
9
|
|
8
10
|
```
|
9
|
-
bundle update
|
10
|
-
bundle exec rake
|
11
11
|
git commit -m "Release X.Y.Z"
|
12
|
-
|
12
|
+
make release
|
13
13
|
```
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# cucumber-core
|
2
2
|
|
3
|
-
[![Chat with us](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cucumber/cucumber-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
3
|
[![CircleCI](https://circleci.com/gh/cucumber/cucumber-ruby-core.svg?style=svg)](https://circleci.com/gh/cucumber/cucumber-ruby-core)
|
5
|
-
[![Build Status](https://travis-ci.org/cucumber/cucumber-ruby-core.svg?branch=master)](https://travis-ci.org/cucumber/cucumber-ruby-core)
|
6
4
|
[![Code Climate](https://codeclimate.com/github/cucumber/cucumber-ruby-core.svg)](https://codeclimate.com/github/cucumber/cucumber-ruby-core)
|
7
5
|
[![Coverage Status](https://coveralls.io/repos/cucumber/cucumber-ruby-core/badge.svg?branch=master)](https://coveralls.io/r/cucumber/cucumber-ruby-core?branch=master)
|
6
|
+
[![pull requests](https://oselvar.com/api/badge?label=pull%20requests&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-ruby-core%2FpullRequests.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby-core)
|
7
|
+
[![issues](https://oselvar.com/api/badge?label=issues&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-ruby-core%2Fissues.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby-core)
|
8
8
|
|
9
9
|
Cucumber Core is the [inner hexagon](http://alistair.cockburn.us/Hexagonal+architecture) for the [Ruby flavour of Cucumber](https://github.com/cucumber/cucumber-ruby).
|
10
10
|
|
@@ -40,7 +40,7 @@ module Cucumber
|
|
40
40
|
lines = source_lines_for_pickle(pickle).sort.reverse
|
41
41
|
tags = pickle.tags.map { |tag| Test::Tag.new(Test::Location.new(uri, source_line_for_pickle_tag(tag)), tag.name) }
|
42
42
|
test_case = Test::Case.new(id_generator.new_id, pickle.name, test_steps, Test::Location.new(uri, lines), tags, pickle.language)
|
43
|
-
@event_bus
|
43
|
+
@event_bus&.test_case_created(test_case, pickle)
|
44
44
|
test_case
|
45
45
|
end
|
46
46
|
|
@@ -48,11 +48,11 @@ module Cucumber
|
|
48
48
|
lines = source_lines_for_pickle_step(pickle_step).sort.reverse
|
49
49
|
multiline_arg = create_multiline_arg(pickle_step, uri)
|
50
50
|
step = Test::Step.new(id_generator.new_id, pickle_step.text, Test::Location.new(uri, lines), multiline_arg)
|
51
|
-
@event_bus
|
51
|
+
@event_bus&.test_step_created(step, pickle_step)
|
52
52
|
step
|
53
53
|
end
|
54
54
|
|
55
|
-
def create_multiline_arg(pickle_step,
|
55
|
+
def create_multiline_arg(pickle_step, _uri)
|
56
56
|
if pickle_step.argument
|
57
57
|
if pickle_step.argument.doc_string
|
58
58
|
doc_string = pickle_step.argument.doc_string
|
data/lib/cucumber/core/event.rb
CHANGED
@@ -22,7 +22,7 @@ module Cucumber
|
|
22
22
|
end
|
23
23
|
|
24
24
|
define_method(:to_h) do
|
25
|
-
attributes.reduce({}) { |result, attribute|
|
25
|
+
attributes.reduce({}) { |result, attribute|
|
26
26
|
value = self.send(attribute)
|
27
27
|
result[attribute] = value
|
28
28
|
result
|
@@ -48,8 +48,8 @@ module Cucumber
|
|
48
48
|
|
49
49
|
def underscore(string)
|
50
50
|
string.to_s.gsub(/::/, '/').
|
51
|
-
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
52
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
51
|
+
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
|
52
|
+
gsub(/([a-z\d])([A-Z])/, '\1_\2').
|
53
53
|
tr("-", "_").
|
54
54
|
downcase
|
55
55
|
end
|
data/lib/cucumber/core/events.rb
CHANGED
@@ -60,12 +60,14 @@ module Cucumber
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def statements
|
63
|
-
prepare_statements
|
63
|
+
prepare_statements(
|
64
|
+
language_statement,
|
64
65
|
comments_statement,
|
65
66
|
tag_statement,
|
66
67
|
name_statement,
|
67
68
|
description_statement,
|
68
69
|
NEW_LINE
|
70
|
+
)
|
69
71
|
end
|
70
72
|
|
71
73
|
def language_statement
|
@@ -85,10 +87,12 @@ module Cucumber
|
|
85
87
|
|
86
88
|
private
|
87
89
|
def statements
|
88
|
-
prepare_statements
|
90
|
+
prepare_statements(
|
91
|
+
comments_statement,
|
89
92
|
tag_statement,
|
90
93
|
name_statement,
|
91
94
|
description_statement
|
95
|
+
)
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
@@ -104,10 +108,12 @@ module Cucumber
|
|
104
108
|
|
105
109
|
private
|
106
110
|
def statements
|
107
|
-
prepare_statements
|
111
|
+
prepare_statements(
|
112
|
+
comments_statement,
|
108
113
|
name_statement,
|
109
114
|
description_statement,
|
110
115
|
NEW_LINE
|
116
|
+
)
|
111
117
|
end
|
112
118
|
end
|
113
119
|
|
@@ -123,10 +129,12 @@ module Cucumber
|
|
123
129
|
|
124
130
|
private
|
125
131
|
def statements
|
126
|
-
prepare_statements
|
132
|
+
prepare_statements(
|
133
|
+
comments_statement,
|
127
134
|
tag_statement,
|
128
135
|
name_statement,
|
129
136
|
description_statement
|
137
|
+
)
|
130
138
|
end
|
131
139
|
end
|
132
140
|
|
@@ -235,12 +243,14 @@ module Cucumber
|
|
235
243
|
|
236
244
|
private
|
237
245
|
def statements
|
238
|
-
prepare_statements
|
246
|
+
prepare_statements(
|
247
|
+
NEW_LINE,
|
239
248
|
comments_statement,
|
240
249
|
tag_statement,
|
241
250
|
name_statement,
|
242
251
|
description_statement,
|
243
252
|
row_statements(2)
|
253
|
+
)
|
244
254
|
end
|
245
255
|
end
|
246
256
|
end
|
@@ -126,11 +126,11 @@ module Cucumber
|
|
126
126
|
module HasDescription
|
127
127
|
private
|
128
128
|
def description
|
129
|
-
options.fetch(:description
|
129
|
+
options.fetch(:description, '').split("\n").map(&:strip)
|
130
130
|
end
|
131
131
|
|
132
132
|
def description_statement
|
133
|
-
description.map { |s| indent(s,2) } unless description.empty?
|
133
|
+
description.map { |s| indent(s, 2) } unless description.empty?
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -23,7 +23,7 @@ module Cucumber
|
|
23
23
|
if event.test_case != @previous_test_case
|
24
24
|
@previous_test_case = event.test_case
|
25
25
|
event.result.describe_to test_cases
|
26
|
-
elsif event.result.passed?
|
26
|
+
elsif event.result.passed? || event.result.skipped?
|
27
27
|
test_cases.flaky
|
28
28
|
test_cases.decrement_failed
|
29
29
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
|
+
require "cucumber/messages"
|
4
|
+
require "cucumber/messages/time_conversion"
|
3
5
|
|
4
6
|
module Cucumber
|
5
7
|
module Core
|
@@ -44,8 +46,8 @@ module Cucumber
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def to_message
|
47
|
-
Cucumber::Messages::
|
48
|
-
status: Cucumber::Messages::
|
49
|
+
Cucumber::Messages::TestStepResult.new(
|
50
|
+
status: Cucumber::Messages::TestStepResultStatus::UNKNOWN,
|
49
51
|
duration: UnknownDuration.new.to_message_duration
|
50
52
|
)
|
51
53
|
end
|
@@ -75,8 +77,8 @@ module Cucumber
|
|
75
77
|
end
|
76
78
|
|
77
79
|
def to_message
|
78
|
-
Cucumber::Messages::
|
79
|
-
status: Cucumber::Messages::
|
80
|
+
Cucumber::Messages::TestStepResult.new(
|
81
|
+
status: Cucumber::Messages::TestStepResultStatus::PASSED,
|
80
82
|
duration: duration.to_message_duration
|
81
83
|
)
|
82
84
|
end
|
@@ -128,8 +130,8 @@ module Cucumber
|
|
128
130
|
message = ""
|
129
131
|
end
|
130
132
|
|
131
|
-
Cucumber::Messages::
|
132
|
-
status: Cucumber::Messages::
|
133
|
+
Cucumber::Messages::TestStepResult.new(
|
134
|
+
status: Cucumber::Messages::TestStepResultStatus::FAILED,
|
133
135
|
duration: duration.to_message_duration,
|
134
136
|
message: message
|
135
137
|
)
|
@@ -216,8 +218,8 @@ module Cucumber
|
|
216
218
|
end
|
217
219
|
|
218
220
|
def to_message
|
219
|
-
Cucumber::Messages::
|
220
|
-
status: Cucumber::Messages::
|
221
|
+
Cucumber::Messages::TestStepResult.new(
|
222
|
+
status: Cucumber::Messages::TestStepResultStatus::UNDEFINED,
|
221
223
|
duration: duration.to_message_duration
|
222
224
|
)
|
223
225
|
end
|
@@ -241,8 +243,8 @@ module Cucumber
|
|
241
243
|
end
|
242
244
|
|
243
245
|
def to_message
|
244
|
-
Cucumber::Messages::
|
245
|
-
status: Cucumber::Messages::
|
246
|
+
Cucumber::Messages::TestStepResult.new(
|
247
|
+
status: Cucumber::Messages::TestStepResultStatus::SKIPPED,
|
246
248
|
duration: duration.to_message_duration
|
247
249
|
)
|
248
250
|
end
|
@@ -266,8 +268,8 @@ module Cucumber
|
|
266
268
|
end
|
267
269
|
|
268
270
|
def to_message
|
269
|
-
Cucumber::Messages::
|
270
|
-
status: Cucumber::Messages::
|
271
|
+
Cucumber::Messages::TestStepResult.new(
|
272
|
+
status: Cucumber::Messages::TestStepResultStatus::PENDING,
|
271
273
|
duration: duration.to_message_duration
|
272
274
|
)
|
273
275
|
end
|
@@ -280,7 +282,7 @@ module Cucumber
|
|
280
282
|
private :settings
|
281
283
|
|
282
284
|
def initialize(strict_types = [])
|
283
|
-
@settings =
|
285
|
+
@settings = STRICT_AFFECTED_TYPES.map { |t| [t, :default] }.to_h
|
284
286
|
strict_types.each do |type|
|
285
287
|
set_strict(true, type)
|
286
288
|
end
|
@@ -310,7 +312,7 @@ module Cucumber
|
|
310
312
|
end
|
311
313
|
|
312
314
|
def merge!(other)
|
313
|
-
settings.
|
315
|
+
settings.each_key do |type|
|
314
316
|
set_strict(other.strict?(type), type) if other.set?(type)
|
315
317
|
end
|
316
318
|
self
|
@@ -369,7 +371,7 @@ module Cucumber
|
|
369
371
|
|
370
372
|
def total(for_status = nil)
|
371
373
|
if for_status
|
372
|
-
@totals.fetch(for_status
|
374
|
+
@totals.fetch(for_status, 0)
|
373
375
|
else
|
374
376
|
@totals.reduce(0) { |total, status| total += status[1] }
|
375
377
|
end
|
@@ -383,7 +385,7 @@ module Cucumber
|
|
383
385
|
|
384
386
|
def get_total(method_name)
|
385
387
|
status = method_name.to_s.gsub('total_', '').to_sym
|
386
|
-
return @totals.fetch(status
|
388
|
+
return @totals.fetch(status, 0)
|
387
389
|
end
|
388
390
|
|
389
391
|
def increment_total(status)
|
@@ -402,7 +404,14 @@ module Cucumber
|
|
402
404
|
end
|
403
405
|
|
404
406
|
def to_message_duration
|
405
|
-
seconds_to_duration(nanoseconds.to_f / NANOSECONDS_PER_SECOND)
|
407
|
+
duration_hash = seconds_to_duration(nanoseconds.to_f / NANOSECONDS_PER_SECOND)
|
408
|
+
duration_hash.transform_keys! do |key|
|
409
|
+
key.to_sym
|
410
|
+
rescue Error
|
411
|
+
return key
|
412
|
+
end
|
413
|
+
|
414
|
+
Cucumber::Messages::Duration.from_h(duration_hash)
|
406
415
|
end
|
407
416
|
end
|
408
417
|
|
@@ -418,7 +427,7 @@ module Cucumber
|
|
418
427
|
end
|
419
428
|
|
420
429
|
def to_message_duration
|
421
|
-
|
430
|
+
Cucumber::Messages::Duration.new(seconds: 0, nanos: 0)
|
422
431
|
end
|
423
432
|
end
|
424
433
|
end
|
@@ -19,7 +19,7 @@ module Cucumber
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def sec
|
22
|
-
nsec / 10
|
22
|
+
nsec / 10**9.0
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
@@ -42,7 +42,7 @@ module Cucumber
|
|
42
42
|
else
|
43
43
|
def time_in_nanoseconds
|
44
44
|
t = Time.now
|
45
|
-
t.to_i * 10
|
45
|
+
t.to_i * 10**9 + t.nsec
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/spec/coverage.rb
CHANGED
@@ -52,7 +52,7 @@ module Cucumber::Core
|
|
52
52
|
end
|
53
53
|
]
|
54
54
|
|
55
|
-
compile(gherkin_documents, event_bus) do |
|
55
|
+
compile(gherkin_documents, event_bus) do |visitor|
|
56
56
|
allow( visitor ).to receive(:test_case)
|
57
57
|
allow( visitor ).to receive(:test_step)
|
58
58
|
allow( visitor ).to receive(:done)
|
@@ -74,7 +74,7 @@ module Cucumber
|
|
74
74
|
|
75
75
|
context "#broadcast method" do
|
76
76
|
it "must be passed an instance of a registered event type" do
|
77
|
-
expect {
|
77
|
+
expect {
|
78
78
|
event_bus.broadcast Events::UnregisteredEvent
|
79
79
|
}.to raise_error(ArgumentError)
|
80
80
|
end
|
@@ -95,7 +95,7 @@ module Cucumber
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it "raises an error if you use an unknown Event ID" do
|
98
|
-
expect {
|
98
|
+
expect {
|
99
99
|
event_bus.on(:some_unknown_event) { :whatever }
|
100
100
|
}.to raise_error(ArgumentError)
|
101
101
|
end
|
@@ -13,7 +13,7 @@ module Cucumber
|
|
13
13
|
|
14
14
|
it "generates events with attributes" do
|
15
15
|
my_event_type = Event.new(:foo, :bar)
|
16
|
-
my_event = my_event_type.new(1,2)
|
16
|
+
my_event = my_event_type.new(1, 2)
|
17
17
|
expect(my_event.attributes).to eq [1, 2]
|
18
18
|
expect(my_event.foo).to eq 1
|
19
19
|
expect(my_event.bar).to eq 2
|
@@ -25,13 +25,13 @@ module Cucumber
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "can be converted to a hash" do
|
28
|
-
my_event = MyEventType.new(1,2)
|
28
|
+
my_event = MyEventType.new(1, 2)
|
29
29
|
expect(my_event.to_h).to eq foo: 1, bar: 2
|
30
30
|
end
|
31
31
|
|
32
32
|
it "has an event_id" do
|
33
33
|
expect(MyEventType.event_id).to eq :my_event_type
|
34
|
-
expect(MyEventType.new(1,2).event_id).to eq :my_event_type
|
34
|
+
expect(MyEventType.new(1, 2).event_id).to eq :my_event_type
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -11,7 +11,7 @@ module Cucumber::Core
|
|
11
11
|
describe ".new" do
|
12
12
|
let(:receiver) { double.as_null_object }
|
13
13
|
|
14
|
-
let(:doc) {
|
14
|
+
let(:doc) {
|
15
15
|
gherkin do
|
16
16
|
feature do
|
17
17
|
scenario 'x' do
|
@@ -46,7 +46,7 @@ module Cucumber::Core
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
# You can pass the names of attributes when building a
|
49
|
+
# You can pass the names of attributes when building a
|
50
50
|
# filter, allowing you to have custom attributes.
|
51
51
|
class NamedBlankingFilter < Filter.new(:name_pattern)
|
52
52
|
def test_case(test_case)
|
@@ -65,6 +65,17 @@ module Cucumber::Core::Report
|
|
65
65
|
expect( @summary.test_cases.total(:flaky) ).to eq(1)
|
66
66
|
expect( @summary.test_cases.total ).to eq(1)
|
67
67
|
end
|
68
|
+
|
69
|
+
it "handless flaky with following skip test cases" do
|
70
|
+
allow(test_case).to receive(:==).and_return(false, true)
|
71
|
+
event_bus.send(:test_case_finished, test_case, failed_result)
|
72
|
+
event_bus.send(:test_case_finished, test_case, skipped_result)
|
73
|
+
|
74
|
+
expect( @summary.test_cases.total(:failed) ).to eq(0)
|
75
|
+
expect( @summary.test_cases.total(:skipped) ).to eq(0)
|
76
|
+
expect( @summary.test_cases.total(:flaky) ).to eq(1)
|
77
|
+
expect( @summary.test_cases.total ).to eq(1)
|
78
|
+
end
|
68
79
|
end
|
69
80
|
|
70
81
|
context "test step summary" do
|
@@ -17,7 +17,7 @@ module Cucumber
|
|
17
17
|
context "location" do
|
18
18
|
|
19
19
|
context "with location passed to the constructor" do
|
20
|
-
|
20
|
+
let(:location) { double }
|
21
21
|
|
22
22
|
it "returns the location passed to the constructor" do
|
23
23
|
action = Action.new(location) {}
|
@@ -151,4 +151,3 @@ module Cucumber
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
154
|
-
|
@@ -15,20 +15,20 @@ module Cucumber
|
|
15
15
|
|
16
16
|
describe "equality" do
|
17
17
|
it "is equal to another table with the same data" do
|
18
|
-
expect( DataTable.new([[1,2],[3,4]]) ).to eq DataTable.new([[1,2],[3,4]])
|
18
|
+
expect( DataTable.new([[1, 2], [3, 4]]) ).to eq DataTable.new([[1, 2], [3, 4]])
|
19
19
|
end
|
20
20
|
|
21
21
|
it "is not equal to another table with different data" do
|
22
|
-
expect( DataTable.new([[1,2],[3,4]]) ).not_to eq DataTable.new([[1,2]])
|
22
|
+
expect( DataTable.new([[1, 2], [3, 4]]) ).not_to eq DataTable.new([[1, 2]])
|
23
23
|
end
|
24
24
|
|
25
25
|
it "is not equal to a non table" do
|
26
|
-
expect( DataTable.new([[1,2],[3,4]]) ).not_to eq Object.new
|
26
|
+
expect( DataTable.new([[1, 2], [3, 4]]) ).not_to eq Object.new
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "#data_table?" do
|
31
|
-
let(:table) { DataTable.new([[1,2],[3,4]]) }
|
31
|
+
let(:table) { DataTable.new([[1, 2], [3, 4]]) }
|
32
32
|
|
33
33
|
it "returns true" do
|
34
34
|
expect(table).to be_data_table
|
@@ -36,7 +36,7 @@ module Cucumber
|
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "#doc_string" do
|
39
|
-
let(:table) { DataTable.new([[1,2],[3,4]]) }
|
39
|
+
let(:table) { DataTable.new([[1, 2], [3, 4]]) }
|
40
40
|
|
41
41
|
it "returns false" do
|
42
42
|
expect(table).not_to be_doc_string
|
@@ -52,7 +52,7 @@ module Cucumber
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'returns a new table with the cells modified by the block' do
|
55
|
-
expect( table.map { |cell| "*#{cell}*" } ).to eq
|
55
|
+
expect( table.map { |cell| "*#{cell}*" } ).to eq DataTable.new([%w{*foo* *bar*}, %w{*1* *2*}])
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -19,9 +19,9 @@ module Cucumber::Core::Test
|
|
19
19
|
expect( one_location ).to eq another_location
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
it "is not equal to a wild card of the same file" do
|
23
|
+
expect( Location.new(file, line) ).not_to eq Location.new(file)
|
24
|
+
end
|
25
25
|
|
26
26
|
context "collections of locations" do
|
27
27
|
it "behave as expected with uniq" do
|
@@ -45,7 +45,7 @@ module Cucumber::Core::Test
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "is file:line:line:line for an arbitrary set of lines" do
|
48
|
-
expect( Location.new("foo.feature", [1,3,5]).to_s ).to eq "foo.feature:1:3:5"
|
48
|
+
expect( Location.new("foo.feature", [1, 3, 5]).to_s ).to eq "foo.feature:1:3:5"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -88,7 +88,7 @@ module Cucumber::Core::Test
|
|
88
88
|
describe "created from source location" do
|
89
89
|
context "when the location is in the tree below pwd" do
|
90
90
|
it "create a relative path from pwd" do
|
91
|
-
expect( Location.from_source_location(Dir.pwd
|
91
|
+
expect( Location.from_source_location("#{Dir.pwd}/path/file.rb", 1).file ).to eq "path/file.rb"
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -109,7 +109,7 @@ module Cucumber::Core::Test
|
|
109
109
|
|
110
110
|
describe "created from file-colon-line" do
|
111
111
|
it "handles also Windows paths" do
|
112
|
-
#
|
112
|
+
# NOTE: running this test on Windows will produce "c:/path/file.rb", but "c:\path\file.rb" on Linux.
|
113
113
|
expect( Location.from_file_colon_line("c:\\path\\file.rb:123").file ).to match(/c:(\\|\/)path(\\|\/)file.rb/)
|
114
114
|
end
|
115
115
|
end
|
@@ -119,7 +119,7 @@ module Cucumber::Core::Test
|
|
119
119
|
expect( Location.of_caller.to_s ).to be_included_in caller[0]
|
120
120
|
end
|
121
121
|
|
122
|
-
context "when specifying additional caller depth"do
|
122
|
+
context "when specifying additional caller depth" do
|
123
123
|
it "use the location of the n:th caller" do
|
124
124
|
expect( Location.of_caller(1).to_s ).to be_included_in caller[1]
|
125
125
|
end
|
@@ -25,7 +25,7 @@ module Cucumber::Core::Test
|
|
25
25
|
|
26
26
|
it "converts to a Cucumber::Message::TestResult" do
|
27
27
|
message = result.to_message
|
28
|
-
expect(message.status).to eq(Cucumber::Messages::
|
28
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::PASSED)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "has a duration" do
|
@@ -75,7 +75,7 @@ module Cucumber::Core::Test
|
|
75
75
|
|
76
76
|
it "converts to a Cucumber::Message::TestResult" do
|
77
77
|
message = result.to_message
|
78
|
-
expect(message.status).to eq(Cucumber::Messages::
|
78
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::FAILED)
|
79
79
|
end
|
80
80
|
|
81
81
|
it "requires both constructor arguments" do
|
@@ -144,7 +144,7 @@ module Cucumber::Core::Test
|
|
144
144
|
|
145
145
|
it "converts to a Cucumber::Message::TestResult" do
|
146
146
|
message = result.to_message
|
147
|
-
expect(message.status).to eq(Cucumber::Messages::
|
147
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::UNKNOWN)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -207,7 +207,7 @@ module Cucumber::Core::Test
|
|
207
207
|
|
208
208
|
it "converts to a Cucumber::Message::TestResult" do
|
209
209
|
message = result.to_message
|
210
|
-
expect(message.status).to eq(Cucumber::Messages::
|
210
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::UNDEFINED)
|
211
211
|
end
|
212
212
|
|
213
213
|
specify { expect( result.to_sym ).to eq :undefined }
|
@@ -236,7 +236,7 @@ module Cucumber::Core::Test
|
|
236
236
|
|
237
237
|
it "converts to a Cucumber::Message::TestResult" do
|
238
238
|
message = result.to_message
|
239
|
-
expect(message.status).to eq(Cucumber::Messages::
|
239
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::SKIPPED)
|
240
240
|
end
|
241
241
|
|
242
242
|
specify { expect( result.to_sym ).to eq :skipped }
|
@@ -263,7 +263,7 @@ module Cucumber::Core::Test
|
|
263
263
|
|
264
264
|
it "converts to a Cucumber::Message::TestResult" do
|
265
265
|
message = result.to_message
|
266
|
-
expect(message.status).to eq(Cucumber::Messages::
|
266
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::PENDING)
|
267
267
|
end
|
268
268
|
|
269
269
|
specify { expect( result.to_sym ).to eq :pending }
|
@@ -344,16 +344,16 @@ module Cucumber::Core::Test
|
|
344
344
|
describe '#merge!' do
|
345
345
|
let(:merged_configuration) { Result::StrictConfiguration.new }
|
346
346
|
it 'sets the not default values from the argument accordingly' do
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
347
|
+
strict_configuration.set_strict(false, :undefined)
|
348
|
+
strict_configuration.set_strict(false, :pending)
|
349
|
+
strict_configuration.set_strict(true, :flaky)
|
350
|
+
merged_configuration.set_strict(true, :pending)
|
351
|
+
merged_configuration.set_strict(false, :flaky)
|
352
|
+
strict_configuration.merge!(merged_configuration)
|
353
|
+
|
354
|
+
expect( strict_configuration.strict?(:undefined) ).to be_falsey
|
355
|
+
expect( strict_configuration.strict?(:pending) ).to be_truthy
|
356
|
+
expect( strict_configuration.strict?(:flaky) ).to be_falsey
|
357
357
|
end
|
358
358
|
end
|
359
359
|
end
|
data/spec/cucumber/core_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
@@ -12,68 +12,68 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2021-07-09 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: cucumber-gherkin
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 13.0.0
|
24
21
|
- - "~>"
|
25
22
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
23
|
+
version: '20.0'
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 20.0.0
|
27
27
|
type: :runtime
|
28
28
|
prerelease: false
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 13.0.0
|
34
31
|
- - "~>"
|
35
32
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
33
|
+
version: '20.0'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 20.0.0
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: cucumber-messages
|
39
39
|
requirement: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '17.0'
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 17.0.0
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '17.0'
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
56
|
+
version: 17.0.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: cucumber-tag-expressions
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
63
|
+
version: '3.0'
|
64
64
|
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
66
|
+
version: 3.0.1
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
73
|
+
version: '3.0'
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 3.0.1
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: coveralls
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,80 +98,100 @@ dependencies:
|
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 13.0.0
|
104
101
|
- - "~>"
|
105
102
|
- !ruby/object:Gem::Version
|
106
103
|
version: '13.0'
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 13.0.6
|
107
107
|
type: :development
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- - ">="
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: 13.0.0
|
114
111
|
- - "~>"
|
115
112
|
- !ruby/object:Gem::Version
|
116
113
|
version: '13.0'
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 13.0.6
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: rspec
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 0.78.0
|
124
121
|
- - "~>"
|
125
122
|
- !ruby/object:Gem::Version
|
126
|
-
version: '
|
123
|
+
version: '3.10'
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 3.10.0
|
127
127
|
type: :development
|
128
128
|
prerelease: false
|
129
129
|
version_requirements: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- - ">="
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: 0.78.0
|
134
131
|
- - "~>"
|
135
132
|
- !ruby/object:Gem::Version
|
136
|
-
version: '
|
133
|
+
version: '3.10'
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: 3.10.0
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
|
-
name:
|
138
|
+
name: rubocop
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
|
-
- - ">="
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
version: 3.9.0
|
144
141
|
- - "~>"
|
145
142
|
- !ruby/object:Gem::Version
|
146
|
-
version: '
|
143
|
+
version: '1.18'
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 1.18.3
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '1.18'
|
151
154
|
- - ">="
|
152
155
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
156
|
+
version: 1.18.3
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: rubocop-packaging
|
159
|
+
requirement: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
154
161
|
- - "~>"
|
155
162
|
- !ruby/object:Gem::Version
|
156
|
-
version: '
|
163
|
+
version: '0.5'
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.5.1
|
167
|
+
type: :development
|
168
|
+
prerelease: false
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.5'
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: 0.5.1
|
157
177
|
- !ruby/object:Gem::Dependency
|
158
178
|
name: unindent
|
159
179
|
requirement: !ruby/object:Gem::Requirement
|
160
180
|
requirements:
|
161
|
-
- - "
|
181
|
+
- - "~>"
|
162
182
|
- !ruby/object:Gem::Version
|
163
183
|
version: '1.0'
|
164
|
-
- - "
|
184
|
+
- - ">="
|
165
185
|
- !ruby/object:Gem::Version
|
166
186
|
version: '1.0'
|
167
187
|
type: :development
|
168
188
|
prerelease: false
|
169
189
|
version_requirements: !ruby/object:Gem::Requirement
|
170
190
|
requirements:
|
171
|
-
- - "
|
191
|
+
- - "~>"
|
172
192
|
- !ruby/object:Gem::Version
|
173
193
|
version: '1.0'
|
174
|
-
- - "
|
194
|
+
- - ">="
|
175
195
|
- !ruby/object:Gem::Version
|
176
196
|
version: '1.0'
|
177
197
|
description: Core library for the Cucumber BDD app
|
@@ -214,7 +234,6 @@ files:
|
|
214
234
|
- lib/cucumber/core/test/tag.rb
|
215
235
|
- lib/cucumber/core/test/timer.rb
|
216
236
|
- lib/cucumber/core/version.rb
|
217
|
-
- spec/capture_warnings.rb
|
218
237
|
- spec/coverage.rb
|
219
238
|
- spec/cucumber/core/compiler_spec.rb
|
220
239
|
- spec/cucumber/core/event_bus_spec.rb
|
@@ -262,31 +281,30 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
281
|
- !ruby/object:Gem::Version
|
263
282
|
version: '0'
|
264
283
|
requirements: []
|
265
|
-
rubygems_version: 3.
|
284
|
+
rubygems_version: 3.1.2
|
266
285
|
signing_key:
|
267
286
|
specification_version: 4
|
268
|
-
summary: cucumber-core-
|
287
|
+
summary: cucumber-core-10.0.0
|
269
288
|
test_files:
|
270
|
-
- spec/cucumber/
|
271
|
-
- spec/cucumber/core/
|
272
|
-
- spec/cucumber/core/
|
273
|
-
- spec/cucumber/core/
|
274
|
-
- spec/cucumber/core/
|
289
|
+
- spec/cucumber/core_spec.rb
|
290
|
+
- spec/cucumber/core/report/summary_spec.rb
|
291
|
+
- spec/cucumber/core/compiler_spec.rb
|
292
|
+
- spec/cucumber/core/gherkin/parser_spec.rb
|
293
|
+
- spec/cucumber/core/gherkin/writer_spec.rb
|
294
|
+
- spec/cucumber/core/event_bus_spec.rb
|
295
|
+
- spec/cucumber/core/filter_spec.rb
|
296
|
+
- spec/cucumber/core/test/timer_spec.rb
|
275
297
|
- spec/cucumber/core/test/case_spec.rb
|
276
298
|
- spec/cucumber/core/test/result_spec.rb
|
277
|
-
- spec/cucumber/core/test/location_spec.rb
|
278
299
|
- spec/cucumber/core/test/action_spec.rb
|
279
|
-
- spec/cucumber/core/test/
|
300
|
+
- spec/cucumber/core/test/filters/locations_filter_spec.rb
|
301
|
+
- spec/cucumber/core/test/runner_spec.rb
|
302
|
+
- spec/cucumber/core/test/doc_string_spec.rb
|
303
|
+
- spec/cucumber/core/test/location_spec.rb
|
304
|
+
- spec/cucumber/core/test/duration_matcher.rb
|
280
305
|
- spec/cucumber/core/test/data_table_spec.rb
|
306
|
+
- spec/cucumber/core/test/step_spec.rb
|
281
307
|
- spec/cucumber/core/test/empty_multiline_argument_spec.rb
|
282
|
-
- spec/cucumber/core/gherkin/parser_spec.rb
|
283
|
-
- spec/cucumber/core/gherkin/writer_spec.rb
|
284
308
|
- spec/cucumber/core/event_spec.rb
|
285
|
-
- spec/cucumber/core/report/summary_spec.rb
|
286
|
-
- spec/cucumber/core/compiler_spec.rb
|
287
|
-
- spec/cucumber/core/event_bus_spec.rb
|
288
|
-
- spec/cucumber/core/filter_spec.rb
|
289
|
-
- spec/cucumber/core_spec.rb
|
290
|
-
- spec/capture_warnings.rb
|
291
|
-
- spec/coverage.rb
|
292
309
|
- spec/report_api_spy.rb
|
310
|
+
- spec/coverage.rb
|
data/spec/capture_warnings.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# With thanks to @myronmarston
|
3
|
-
# https://github.com/vcr/vcr/blob/master/spec/capture_warnings.rb
|
4
|
-
|
5
|
-
module CaptureWarnings
|
6
|
-
def report_warnings(&block)
|
7
|
-
current_dir = Dir.pwd
|
8
|
-
warnings, errors = capture_error(&block).partition { |line| line.include?('warning') }
|
9
|
-
project_warnings, other_warnings = warnings.uniq.partition { |line| line.include?(current_dir) && !line.include?('/vendor/') }
|
10
|
-
|
11
|
-
if errors.any?
|
12
|
-
puts errors.join("\n")
|
13
|
-
end
|
14
|
-
|
15
|
-
if other_warnings.any?
|
16
|
-
puts "#{ other_warnings.count } non-cucumber-core warnings detected, set VIEW_OTHER_WARNINGS=true to see them."
|
17
|
-
print_warnings('other', other_warnings) if ENV['VIEW_OTHER_WARNINGS']
|
18
|
-
end
|
19
|
-
|
20
|
-
# Until they fix https://bugs.ruby-lang.org/issues/10661
|
21
|
-
if RUBY_VERSION == "2.2.0"
|
22
|
-
project_warnings = project_warnings.reject { |w| w =~ /warning: possible reference to past scope/ }
|
23
|
-
end
|
24
|
-
|
25
|
-
if project_warnings.any?
|
26
|
-
puts "#{ project_warnings.count } cucumber-core warnings detected"
|
27
|
-
print_warnings('cucumber-core', project_warnings)
|
28
|
-
fail "Please remove all cucumber-core warnings."
|
29
|
-
end
|
30
|
-
|
31
|
-
ensure_system_exit_if_required
|
32
|
-
end
|
33
|
-
|
34
|
-
def capture_error(&block)
|
35
|
-
old_stderr = STDERR.clone
|
36
|
-
pipe_r, pipe_w = IO.pipe
|
37
|
-
pipe_r.sync = true
|
38
|
-
error = String.new
|
39
|
-
reader = Thread.new do
|
40
|
-
begin
|
41
|
-
loop do
|
42
|
-
error << pipe_r.readpartial(1024)
|
43
|
-
end
|
44
|
-
rescue EOFError
|
45
|
-
end
|
46
|
-
end
|
47
|
-
STDERR.reopen(pipe_w)
|
48
|
-
block.call
|
49
|
-
ensure
|
50
|
-
capture_system_exit
|
51
|
-
STDERR.reopen(old_stderr)
|
52
|
-
pipe_w.close
|
53
|
-
reader.join
|
54
|
-
return error.split("\n")
|
55
|
-
end
|
56
|
-
|
57
|
-
def print_warnings(type, warnings)
|
58
|
-
puts
|
59
|
-
puts "-" * 30 + " #{type} warnings: " + "-" * 30
|
60
|
-
puts
|
61
|
-
puts warnings.join("\n")
|
62
|
-
puts
|
63
|
-
puts "-" * 75
|
64
|
-
puts
|
65
|
-
end
|
66
|
-
|
67
|
-
def ensure_system_exit_if_required
|
68
|
-
raise @system_exit if @system_exit
|
69
|
-
end
|
70
|
-
|
71
|
-
def capture_system_exit
|
72
|
-
@system_exit = $!
|
73
|
-
end
|
74
|
-
end
|