cucumber-compatibility-kit 9.1.0 → 9.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/keys_checker.rb +5 -1
- data/lib/messages_comparator.rb +1 -0
- data/spec/keys_checker_spec.rb +29 -0
- data/spec/messages_comparator_spec.rb +26 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afa658b4a280cda50327bf09b20bee6d72b6199c1009164e3a355dc2f853753b
|
4
|
+
data.tar.gz: bb15dfd4c0b129db899feab720eefd10d942e17367fdcfda95c7b67233ed4e34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78f2b8199eaa1e82c44f896043edcda109ebc3c348bac08ae4cf833e0068bfdc8e4ef860d171062fb96d05c71523c16bcad35cfb064dcb45a4c64ab141c4add6
|
7
|
+
data.tar.gz: 170a260c3abd88bd526f95adb3c9ee484842ae688297c2d88054aecf0887032d07f336b28c420e9c4a845d75604857ea1233a32a8ee4da26833f3632b15c96b6
|
data/lib/keys_checker.rb
CHANGED
@@ -14,11 +14,15 @@ module CCK
|
|
14
14
|
|
15
15
|
missing_keys = (expected_keys - found_keys)
|
16
16
|
|
17
|
-
extra_keys = (found_keys - expected_keys)
|
17
|
+
extra_keys = (found_keys - expected_keys).reject { |key|
|
18
|
+
ENV['CI'] && found.class == Cucumber::Messages::Meta && key == :ci
|
19
|
+
}
|
18
20
|
|
19
21
|
errors << "Found extra keys in message #{found.class.name}: #{extra_keys}" unless extra_keys.empty?
|
20
22
|
errors << "Missing keys in message #{found.class.name}: #{missing_keys}" unless missing_keys.empty?
|
21
23
|
errors
|
24
|
+
rescue StandardError => e
|
25
|
+
["Unexpected error: #{e.message}"]
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
data/lib/messages_comparator.rb
CHANGED
@@ -62,6 +62,7 @@ module CCK
|
|
62
62
|
return if found.is_a?(Cucumber::Messages::Pickle)
|
63
63
|
return if found.is_a?(Cucumber::Messages::Timestamp) && expected.is_a?(Cucumber::Messages::Timestamp)
|
64
64
|
return if found.is_a?(Cucumber::Messages::Duration) && expected.is_a?(Cucumber::Messages::Duration)
|
65
|
+
return if ENV['CI'] && found.is_a?(Cucumber::Messages::Ci) && expected.nil?
|
65
66
|
|
66
67
|
@compared << found.class.name
|
67
68
|
@all_errors << @validator.compare(found, expected)
|
data/spec/keys_checker_spec.rb
CHANGED
@@ -73,5 +73,34 @@ describe CCK::KeysChecker do
|
|
73
73
|
expect(subject.compare(default_set, default_not_set)).to be_empty
|
74
74
|
end
|
75
75
|
end
|
76
|
+
|
77
|
+
context 'when executed as part of a CI' do
|
78
|
+
before do
|
79
|
+
allow(ENV).to receive(:[]).with('CI').and_return(true)
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'ignores actual CI related messages' do
|
83
|
+
found = Cucumber::Messages::Meta.new(
|
84
|
+
ci: Cucumber::Messages::Ci.new(name: 'Some CI')
|
85
|
+
)
|
86
|
+
|
87
|
+
expected = Cucumber::Messages::Meta.new
|
88
|
+
|
89
|
+
expect(subject.compare(found, expected)).to be_empty
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'when an unexcpected error occurs' do
|
94
|
+
it 'does not raise error' do
|
95
|
+
expect {
|
96
|
+
subject.compare(nil, nil)
|
97
|
+
}.not_to raise_error
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'returns the error' do
|
101
|
+
expect(subject.compare(nil, nil))
|
102
|
+
.to eq(['Unexpected error: wrong number of arguments (given 1, expected 0)'])
|
103
|
+
end
|
104
|
+
end
|
76
105
|
end
|
77
106
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'cucumber/messages'
|
3
|
+
require_relative '../lib/messages_comparator'
|
4
|
+
|
5
|
+
describe CCK::MessagesComparator do
|
6
|
+
subject() { CCK::MessagesComparator }
|
7
|
+
|
8
|
+
context 'when executed as part of a CI' do
|
9
|
+
before do
|
10
|
+
allow(ENV).to receive(:[]).with('CI').and_return(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'ignores actual CI related messages' do
|
14
|
+
found_message_ci = Cucumber::Messages::Ci.new(name: 'Some CI')
|
15
|
+
found_message_meta = Cucumber::Messages::Meta.new(ci: found_message_ci)
|
16
|
+
found_message_envelope = Cucumber::Messages::Envelope.new(meta: found_message_meta)
|
17
|
+
|
18
|
+
expected_message_meta = Cucumber::Messages::Meta.new()
|
19
|
+
expected_message_envelope = Cucumber::Messages::Envelope.new(meta: expected_message_meta)
|
20
|
+
|
21
|
+
comparator = subject.new(CCK::KeysChecker, [found_message_envelope], [expected_message_envelope])
|
22
|
+
|
23
|
+
expect(comparator.errors).to be_empty
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-compatibility-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.1.
|
4
|
+
version: 9.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurélien Reeves
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- spec/capture_warnings.rb
|
131
131
|
- spec/cucumber-compatibility-kit_spec.rb
|
132
132
|
- spec/keys_checker_spec.rb
|
133
|
+
- spec/messages_comparator_spec.rb
|
133
134
|
homepage: https://github.com/cucumber/common
|
134
135
|
licenses:
|
135
136
|
- MIT
|
@@ -158,8 +159,9 @@ requirements: []
|
|
158
159
|
rubygems_version: 3.1.2
|
159
160
|
signing_key:
|
160
161
|
specification_version: 4
|
161
|
-
summary: cucumber-compatibility-kit-9.1.
|
162
|
+
summary: cucumber-compatibility-kit-9.1.1
|
162
163
|
test_files:
|
163
164
|
- spec/capture_warnings.rb
|
165
|
+
- spec/messages_comparator_spec.rb
|
164
166
|
- spec/cucumber-compatibility-kit_spec.rb
|
165
167
|
- spec/keys_checker_spec.rb
|