cucumber-compatibility-kit 14.0.0 → 15.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -35
- data/features/attachments/attachments.feature.ndjson +1 -1
- data/features/cdata/cdata.feature.ndjson +1 -1
- data/features/data-tables/data-tables.feature.ndjson +1 -1
- data/features/examples-tables/examples-tables.feature.ndjson +1 -1
- data/features/hooks/hooks.feature.ndjson +1 -1
- data/features/markdown/markdown.feature.md.ndjson +1 -1
- data/features/minimal/minimal.feature.ndjson +1 -1
- data/features/parameter-types/parameter-types.feature.ndjson +1 -1
- data/features/pending/pending.feature.ndjson +4 -4
- data/features/retry/retry.feature.ndjson +1 -1
- data/features/rules/rules.feature.ndjson +1 -1
- data/features/skipped/skipped.feature.ndjson +1 -1
- data/features/stack-traces/stack-traces.feature.ndjson +1 -1
- data/features/undefined/undefined.feature.ndjson +1 -1
- data/features/unknown-parameter-type/unknown-parameter-type.feature.ndjson +1 -1
- data/lib/{cucumber/cucumber-compatibility-kit.rb → cck/examples.rb} +15 -21
- data/lib/cucumber-compatibility-kit.rb +1 -1
- metadata +21 -80
- data/features/attachments/attachments.feature.rb +0 -38
- data/features/cdata/cdata.feature.rb +0 -5
- data/features/data-tables/data-tables.feature.rb +0 -9
- data/features/examples-tables/examples-tables.feature.rb +0 -13
- data/features/hooks/hooks.feature.rb +0 -29
- data/features/minimal/minimal.feature.rb +0 -5
- data/features/parameter-types/parameter-types.feature.rb +0 -21
- data/features/pending/pending.feature.rb +0 -13
- data/features/retry/retry.feature.rb +0 -21
- data/features/rules/rules.feature.rb +0 -25
- data/features/skipped/skipped.feature.rb +0 -17
- data/features/stack-traces/stack-traces.feature.rb +0 -5
- data/features/undefined/undefined.feature.rb +0 -9
- data/features/unknown-parameter-type/unknown-parameter-type.feature.rb +0 -5
- data/lib/cck/helpers.rb +0 -11
- data/lib/cck/keys_checker.rb +0 -64
- data/lib/cck/messages_comparator.rb +0 -97
- data/lib/keys_checker.rb +0 -3
- data/lib/messages_comparator.rb +0 -3
- data/lib/shared_examples.rb +0 -45
- data/spec/cck/keys_checker_spec.rb +0 -67
- data/spec/cck/messages_comparator_spec.rb +0 -29
- data/spec/cucumber/cucumber-compatibility-kit_spec.rb +0 -65
metadata
CHANGED
@@ -1,58 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-compatibility-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 15.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurélien Reeves
|
8
8
|
- Aslak Hellesøy
|
9
9
|
- Vincent Prêtre
|
10
|
+
- Luke Hill
|
10
11
|
- Cucumber Ltd
|
11
12
|
autorequire:
|
12
13
|
bindir: bin
|
13
14
|
cert_chain: []
|
14
|
-
date:
|
15
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
15
16
|
dependencies:
|
16
17
|
- !ruby/object:Gem::Dependency
|
17
18
|
name: cucumber-messages
|
18
19
|
requirement: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
|
-
- - "
|
21
|
+
- - ">"
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
23
|
+
version: '20'
|
23
24
|
- - "<"
|
24
25
|
- !ruby/object:Gem::Version
|
25
|
-
version: '
|
26
|
+
version: '25'
|
26
27
|
type: :runtime
|
27
28
|
prerelease: false
|
28
29
|
version_requirements: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- - "
|
31
|
+
- - ">"
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
+
version: '20'
|
33
34
|
- - "<"
|
34
35
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rake
|
38
|
-
requirement: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - "~>"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '13.0'
|
43
|
-
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 13.0.6
|
46
|
-
type: :runtime
|
47
|
-
prerelease: false
|
48
|
-
version_requirements: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - "~>"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '13.0'
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 13.0.6
|
36
|
+
version: '25'
|
56
37
|
- !ruby/object:Gem::Dependency
|
57
38
|
name: rspec
|
58
39
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,7 +41,7 @@ dependencies:
|
|
60
41
|
- - "~>"
|
61
42
|
- !ruby/object:Gem::Version
|
62
43
|
version: '3.12'
|
63
|
-
type: :
|
44
|
+
type: :development
|
64
45
|
prerelease: false
|
65
46
|
version_requirements: !ruby/object:Gem::Requirement
|
66
47
|
requirements:
|
@@ -73,56 +54,42 @@ dependencies:
|
|
73
54
|
requirements:
|
74
55
|
- - "~>"
|
75
56
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1.
|
57
|
+
version: 1.50.2
|
77
58
|
type: :development
|
78
59
|
prerelease: false
|
79
60
|
version_requirements: !ruby/object:Gem::Requirement
|
80
61
|
requirements:
|
81
62
|
- - "~>"
|
82
63
|
- !ruby/object:Gem::Version
|
83
|
-
version: 1.
|
64
|
+
version: 1.50.2
|
84
65
|
- !ruby/object:Gem::Dependency
|
85
66
|
name: rubocop-performance
|
86
67
|
requirement: !ruby/object:Gem::Requirement
|
87
68
|
requirements:
|
88
69
|
- - "~>"
|
89
70
|
- !ruby/object:Gem::Version
|
90
|
-
version: 1.
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - "~>"
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: 1.7.0
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rubocop-rake
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - "~>"
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: 0.5.0
|
71
|
+
version: 1.17.1
|
105
72
|
type: :development
|
106
73
|
prerelease: false
|
107
74
|
version_requirements: !ruby/object:Gem::Requirement
|
108
75
|
requirements:
|
109
76
|
- - "~>"
|
110
77
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
78
|
+
version: 1.17.1
|
112
79
|
- !ruby/object:Gem::Dependency
|
113
80
|
name: rubocop-rspec
|
114
81
|
requirement: !ruby/object:Gem::Requirement
|
115
82
|
requirements:
|
116
83
|
- - "~>"
|
117
84
|
- !ruby/object:Gem::Version
|
118
|
-
version: 2.
|
85
|
+
version: 2.20.0
|
119
86
|
type: :development
|
120
87
|
prerelease: false
|
121
88
|
version_requirements: !ruby/object:Gem::Requirement
|
122
89
|
requirements:
|
123
90
|
- - "~>"
|
124
91
|
- !ruby/object:Gem::Version
|
125
|
-
version: 2.
|
92
|
+
version: 2.20.0
|
126
93
|
description: Kit to check compatibility with official cucumber implementation
|
127
94
|
email: cukebot@cucumber.io
|
128
95
|
executables: []
|
@@ -132,64 +99,41 @@ files:
|
|
132
99
|
- README.md
|
133
100
|
- features/attachments/attachments.feature
|
134
101
|
- features/attachments/attachments.feature.ndjson
|
135
|
-
- features/attachments/attachments.feature.rb
|
136
102
|
- features/attachments/cucumber.jpeg
|
137
103
|
- features/attachments/cucumber.png
|
138
104
|
- features/attachments/document.pdf
|
139
105
|
- features/cdata/cdata.feature
|
140
106
|
- features/cdata/cdata.feature.ndjson
|
141
|
-
- features/cdata/cdata.feature.rb
|
142
107
|
- features/data-tables/data-tables.feature
|
143
108
|
- features/data-tables/data-tables.feature.ndjson
|
144
|
-
- features/data-tables/data-tables.feature.rb
|
145
109
|
- features/examples-tables/examples-tables.feature
|
146
110
|
- features/examples-tables/examples-tables.feature.ndjson
|
147
|
-
- features/examples-tables/examples-tables.feature.rb
|
148
111
|
- features/hooks/cucumber.svg
|
149
112
|
- features/hooks/hooks.feature
|
150
113
|
- features/hooks/hooks.feature.ndjson
|
151
|
-
- features/hooks/hooks.feature.rb
|
152
114
|
- features/markdown/markdown.feature.md
|
153
115
|
- features/markdown/markdown.feature.md.ndjson
|
154
116
|
- features/minimal/minimal.feature
|
155
117
|
- features/minimal/minimal.feature.ndjson
|
156
|
-
- features/minimal/minimal.feature.rb
|
157
118
|
- features/parameter-types/parameter-types.feature
|
158
119
|
- features/parameter-types/parameter-types.feature.ndjson
|
159
|
-
- features/parameter-types/parameter-types.feature.rb
|
160
120
|
- features/pending/pending.feature
|
161
121
|
- features/pending/pending.feature.ndjson
|
162
|
-
- features/pending/pending.feature.rb
|
163
122
|
- features/retry/retry.arguments.txt
|
164
123
|
- features/retry/retry.feature
|
165
124
|
- features/retry/retry.feature.ndjson
|
166
|
-
- features/retry/retry.feature.rb
|
167
125
|
- features/rules/rules.feature
|
168
126
|
- features/rules/rules.feature.ndjson
|
169
|
-
- features/rules/rules.feature.rb
|
170
127
|
- features/skipped/skipped.feature
|
171
128
|
- features/skipped/skipped.feature.ndjson
|
172
|
-
- features/skipped/skipped.feature.rb
|
173
129
|
- features/stack-traces/stack-traces.feature
|
174
130
|
- features/stack-traces/stack-traces.feature.ndjson
|
175
|
-
- features/stack-traces/stack-traces.feature.rb
|
176
131
|
- features/undefined/undefined.feature
|
177
132
|
- features/undefined/undefined.feature.ndjson
|
178
|
-
- features/undefined/undefined.feature.rb
|
179
133
|
- features/unknown-parameter-type/unknown-parameter-type.feature
|
180
134
|
- features/unknown-parameter-type/unknown-parameter-type.feature.ndjson
|
181
|
-
-
|
182
|
-
- lib/cck/helpers.rb
|
183
|
-
- lib/cck/keys_checker.rb
|
184
|
-
- lib/cck/messages_comparator.rb
|
135
|
+
- lib/cck/examples.rb
|
185
136
|
- lib/cucumber-compatibility-kit.rb
|
186
|
-
- lib/cucumber/cucumber-compatibility-kit.rb
|
187
|
-
- lib/keys_checker.rb
|
188
|
-
- lib/messages_comparator.rb
|
189
|
-
- lib/shared_examples.rb
|
190
|
-
- spec/cck/keys_checker_spec.rb
|
191
|
-
- spec/cck/messages_comparator_spec.rb
|
192
|
-
- spec/cucumber/cucumber-compatibility-kit_spec.rb
|
193
137
|
homepage: https://github.com/cucumber/compatibility-kit
|
194
138
|
licenses:
|
195
139
|
- MIT
|
@@ -208,18 +152,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
208
152
|
requirements:
|
209
153
|
- - ">="
|
210
154
|
- !ruby/object:Gem::Version
|
211
|
-
version: '2.
|
155
|
+
version: '2.6'
|
212
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
157
|
requirements:
|
214
158
|
- - ">="
|
215
159
|
- !ruby/object:Gem::Version
|
216
|
-
version:
|
160
|
+
version: 3.0.9
|
217
161
|
requirements: []
|
218
162
|
rubygems_version: 3.4.10
|
219
163
|
signing_key:
|
220
164
|
specification_version: 4
|
221
|
-
summary: cucumber-compatibility-kit-
|
222
|
-
test_files:
|
223
|
-
- spec/cck/keys_checker_spec.rb
|
224
|
-
- spec/cck/messages_comparator_spec.rb
|
225
|
-
- spec/cucumber/cucumber-compatibility-kit_spec.rb
|
165
|
+
summary: cucumber-compatibility-kit-15.0.0
|
166
|
+
test_files: []
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Cucumber-JVM needs to use a Before hook in order to create attachments
|
4
|
-
# NB: We should probably try to remove this
|
5
|
-
Before { nil }
|
6
|
-
|
7
|
-
When('the string {string} is attached as {string}') do |text, media_type|
|
8
|
-
attach(text, media_type)
|
9
|
-
end
|
10
|
-
|
11
|
-
When('the string {string} is logged') do |text|
|
12
|
-
log(text)
|
13
|
-
end
|
14
|
-
|
15
|
-
When('text with ANSI escapes is logged') do
|
16
|
-
log("This displays a \x1b[31mr\x1b[0m\x1b[91ma\x1b[0m\x1b[33mi\x1b[0m\x1b[32mn\x1b[0m\x1b[34mb\x1b[0m\x1b[95mo\x1b[0m\x1b[35mw\x1b[0m")
|
17
|
-
end
|
18
|
-
|
19
|
-
When('the following string is attached as {string}:') do |media_type, doc_string|
|
20
|
-
attach(doc_string, media_type)
|
21
|
-
end
|
22
|
-
|
23
|
-
When('an array with {int} bytes is attached as {string}') do |size, media_type|
|
24
|
-
data = (0..size - 1).map { |i| [i].pack('C') }.join
|
25
|
-
attach(data, media_type)
|
26
|
-
end
|
27
|
-
|
28
|
-
When('a JPEG image is attached') do
|
29
|
-
attach(File.open("#{__dir__}/cucumber.jpeg"), 'image/jpeg')
|
30
|
-
end
|
31
|
-
|
32
|
-
When('a PNG image is attached') do
|
33
|
-
attach(File.open("#{__dir__}/cucumber.png"), 'image/png')
|
34
|
-
end
|
35
|
-
|
36
|
-
When('a PDF document is attached and renamed') do
|
37
|
-
attach(File.open("#{__dir__}/document.pdf"), 'document/pdf', 'renamed.pdf')
|
38
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Given('there are {int} cucumbers') do |initial_count|
|
4
|
-
@count = initial_count
|
5
|
-
end
|
6
|
-
|
7
|
-
When('I eat {int} cucumbers') do |eat_count|
|
8
|
-
@count -= eat_count
|
9
|
-
end
|
10
|
-
|
11
|
-
Then('I should have {int} cucumbers') do |expected_count|
|
12
|
-
expect(@count).to eq(expected_count)
|
13
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Before do
|
4
|
-
# no-op
|
5
|
-
end
|
6
|
-
|
7
|
-
Before(name: 'A named hook') do
|
8
|
-
# no-op
|
9
|
-
end
|
10
|
-
|
11
|
-
When('a step passes') do
|
12
|
-
# no-op
|
13
|
-
end
|
14
|
-
|
15
|
-
When('a step fails') do
|
16
|
-
raise 'Exception in step'
|
17
|
-
end
|
18
|
-
|
19
|
-
After do
|
20
|
-
# no-op
|
21
|
-
end
|
22
|
-
|
23
|
-
After('@some-tag or @some-other-tag') do
|
24
|
-
raise 'Exception in conditional hook'
|
25
|
-
end
|
26
|
-
|
27
|
-
After('@with-attachment') do
|
28
|
-
attach(File.open("#{__dir__}/cucumber.svg"), 'image/svg+xml')
|
29
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Flight
|
4
|
-
attr_reader :from, :to
|
5
|
-
|
6
|
-
def initialize(from, to)
|
7
|
-
@from = from
|
8
|
-
@to = to
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
ParameterType(
|
13
|
-
name: 'flight',
|
14
|
-
regexp: /([A-Z]{3})-([A-Z]{3})/,
|
15
|
-
transformer: ->(from, to) { Flight.new(from, to) }
|
16
|
-
)
|
17
|
-
|
18
|
-
Given('{flight} has been delayed') do |flight|
|
19
|
-
expect(flight.from).to eq('LHR')
|
20
|
-
expect(flight.to).to eq('CDG')
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Given('a step that always passes') do
|
4
|
-
# no-op
|
5
|
-
end
|
6
|
-
|
7
|
-
second_time_pass = 0
|
8
|
-
Given('a step that passes the second time') do
|
9
|
-
second_time_pass += 1
|
10
|
-
raise 'Exception in step' if second_time_pass < 2
|
11
|
-
end
|
12
|
-
|
13
|
-
third_time_pass = 0
|
14
|
-
Given('a step that passes the third time') do
|
15
|
-
third_time_pass += 1
|
16
|
-
raise 'Exception in step' if third_time_pass < 3
|
17
|
-
end
|
18
|
-
|
19
|
-
Given('a step that always fails') do
|
20
|
-
raise 'Exception in step'
|
21
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Given('the customer has {int} cents') do |money|
|
4
|
-
@money = money
|
5
|
-
end
|
6
|
-
|
7
|
-
Given('there are chocolate bars in stock') do
|
8
|
-
@stock = ['Mars']
|
9
|
-
end
|
10
|
-
|
11
|
-
Given('there are no chocolate bars in stock') do
|
12
|
-
@stock = []
|
13
|
-
end
|
14
|
-
|
15
|
-
When('the customer tries to buy a {int} cent chocolate bar') do |price|
|
16
|
-
@chocolate << @stock.pop if @money >= price
|
17
|
-
end
|
18
|
-
|
19
|
-
Then('the sale should not happen') do
|
20
|
-
expect(@chocolate).to be_nil
|
21
|
-
end
|
22
|
-
|
23
|
-
Then('the sale should happen') do
|
24
|
-
expect(@chocolate).not_to be_nil
|
25
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Before('@skip') do
|
4
|
-
skip_this_scenario('')
|
5
|
-
end
|
6
|
-
|
7
|
-
Given('a step that does not skip') do
|
8
|
-
# no-op
|
9
|
-
end
|
10
|
-
|
11
|
-
Given('a step that is skipped') do
|
12
|
-
# no-op
|
13
|
-
end
|
14
|
-
|
15
|
-
Given('I skip a step') do
|
16
|
-
skip_this_scenario('')
|
17
|
-
end
|
data/lib/cck/helpers.rb
DELETED
data/lib/cck/keys_checker.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CCK
|
4
|
-
class KeysChecker
|
5
|
-
def self.compare(detected, expected)
|
6
|
-
new(detected, expected).compare
|
7
|
-
end
|
8
|
-
|
9
|
-
attr_reader :detected, :expected
|
10
|
-
|
11
|
-
def initialize(detected, expected)
|
12
|
-
@detected = detected
|
13
|
-
@expected = expected
|
14
|
-
end
|
15
|
-
|
16
|
-
def compare
|
17
|
-
return [] if identical_keys?
|
18
|
-
|
19
|
-
errors << "Detected extra keys in message #{message_name}: #{extra_keys}" if extra_keys.any?
|
20
|
-
errors << "Missing keys in message #{message_name}: #{missing_keys}" if missing_keys.any?
|
21
|
-
errors
|
22
|
-
rescue StandardError => e
|
23
|
-
["Unexpected error: #{e.message}"]
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def detected_keys
|
29
|
-
@detected_keys ||= ordered_uniq_hash_keys(detected)
|
30
|
-
end
|
31
|
-
|
32
|
-
def expected_keys
|
33
|
-
@expected_keys ||= ordered_uniq_hash_keys(expected)
|
34
|
-
end
|
35
|
-
|
36
|
-
def identical_keys?
|
37
|
-
detected_keys == expected_keys
|
38
|
-
end
|
39
|
-
|
40
|
-
def missing_keys
|
41
|
-
(expected_keys - detected_keys).reject { |key| meta_message? && key == :ci }
|
42
|
-
end
|
43
|
-
|
44
|
-
def extra_keys
|
45
|
-
(detected_keys - expected_keys).reject { |key| meta_message? && key == :ci }
|
46
|
-
end
|
47
|
-
|
48
|
-
def meta_message?
|
49
|
-
detected.instance_of?(Cucumber::Messages::Meta)
|
50
|
-
end
|
51
|
-
|
52
|
-
def message_name
|
53
|
-
detected.class.name
|
54
|
-
end
|
55
|
-
|
56
|
-
def ordered_uniq_hash_keys(object)
|
57
|
-
object.to_h(reject_nil_values: true).keys.sort
|
58
|
-
end
|
59
|
-
|
60
|
-
def errors
|
61
|
-
@errors ||= []
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'keys_checker'
|
4
|
-
require_relative 'helpers'
|
5
|
-
|
6
|
-
module CCK
|
7
|
-
class MessagesComparator
|
8
|
-
include Helpers
|
9
|
-
|
10
|
-
def initialize(detected, expected)
|
11
|
-
compare(detected, expected)
|
12
|
-
end
|
13
|
-
|
14
|
-
def errors
|
15
|
-
all_errors.flatten
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def compare(detected, expected)
|
21
|
-
detected_by_type = messages_by_type(detected)
|
22
|
-
expected_by_type = messages_by_type(expected)
|
23
|
-
|
24
|
-
detected_by_type.each_key do |type|
|
25
|
-
compare_list(detected_by_type[type], expected_by_type[type])
|
26
|
-
rescue StandardError => e
|
27
|
-
all_errors << "Error while comparing #{type}: #{e.message}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def messages_by_type(messages)
|
32
|
-
by_type = Hash.new { |h, k| h[k] = [] }
|
33
|
-
messages.each do |msg|
|
34
|
-
by_type[message_type(msg)] << remove_envelope(msg)
|
35
|
-
end
|
36
|
-
by_type
|
37
|
-
end
|
38
|
-
|
39
|
-
def remove_envelope(message)
|
40
|
-
message.send(message_type(message))
|
41
|
-
end
|
42
|
-
|
43
|
-
def compare_list(detected, expected)
|
44
|
-
detected.each_with_index do |message, index|
|
45
|
-
compare_message(message, expected[index])
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def compare_message(detected, expected)
|
50
|
-
return if not_message?(detected)
|
51
|
-
return if ignorable?(detected)
|
52
|
-
return if incomparable?(detected)
|
53
|
-
|
54
|
-
all_errors << CCK::KeysChecker.compare(detected, expected)
|
55
|
-
compare_sub_messages(detected, expected)
|
56
|
-
end
|
57
|
-
|
58
|
-
def not_message?(detected)
|
59
|
-
!detected.is_a?(Cucumber::Messages::Message)
|
60
|
-
end
|
61
|
-
|
62
|
-
# These messages we need to ignore because they are too large or they feature timestamps which always vary
|
63
|
-
def ignorable?(detected)
|
64
|
-
too_large_message?(detected) || time_message?(detected)
|
65
|
-
end
|
66
|
-
|
67
|
-
def too_large_message?(detected)
|
68
|
-
detected.is_a?(Cucumber::Messages::GherkinDocument) || detected.is_a?(Cucumber::Messages::Pickle)
|
69
|
-
end
|
70
|
-
|
71
|
-
def time_message?(detected)
|
72
|
-
detected.is_a?(Cucumber::Messages::Timestamp) || detected.is_a?(Cucumber::Messages::Duration)
|
73
|
-
end
|
74
|
-
|
75
|
-
# These messages we need to ignore because they are often not of identical shape/value
|
76
|
-
def incomparable?(detected)
|
77
|
-
detected.is_a?(Cucumber::Messages::Ci) || detected.is_a?(Cucumber::Messages::Git)
|
78
|
-
end
|
79
|
-
|
80
|
-
def compare_sub_messages(detected, expected)
|
81
|
-
return unless expected.respond_to? :to_h
|
82
|
-
|
83
|
-
expected.to_h.each_key do |key|
|
84
|
-
value = expected.send(key)
|
85
|
-
if value.is_a?(Array)
|
86
|
-
compare_list(detected.send(key), value)
|
87
|
-
else
|
88
|
-
compare_message(detected.send(key), value)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def all_errors
|
94
|
-
@all_errors ||= []
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
data/lib/keys_checker.rb
DELETED
data/lib/messages_comparator.rb
DELETED