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
data/lib/shared_examples.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
require 'rspec'
|
5
|
-
require 'cucumber/messages'
|
6
|
-
|
7
|
-
require 'messages_comparator'
|
8
|
-
require 'keys_checker'
|
9
|
-
|
10
|
-
RSpec.shared_examples 'cucumber compatibility kit' do
|
11
|
-
include CCK::Helpers
|
12
|
-
|
13
|
-
# NOTE: to use those examples, you need to define:
|
14
|
-
# let(:example) { } # the name of the example to test
|
15
|
-
# let(:messages) { } # the messages to validate
|
16
|
-
|
17
|
-
let(:example) { raise '`example` missing: add `let(:example) { example_name }` to your spec' }
|
18
|
-
let(:messages) { raise '`messages` missing: add `let(:messages) { ndjson }` to your spec' }
|
19
|
-
|
20
|
-
let(:example_path) { Cucumber::CompatibilityKit.example_path(example) }
|
21
|
-
|
22
|
-
let(:parsed_original) { parse_ndjson_file("#{example_path}/#{example}.feature.ndjson") }
|
23
|
-
let(:parsed_generated) { parse_ndjson(messages) }
|
24
|
-
|
25
|
-
let(:original_messages_types) { parsed_original.map { |msg| message_type(msg) } }
|
26
|
-
let(:generated_messages_types) { parsed_generated.map { |msg| message_type(msg) } }
|
27
|
-
|
28
|
-
it 'generates valid message types' do
|
29
|
-
expect(generated_messages_types).to contain_exactly(*original_messages_types)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'generates valid message structure' do
|
33
|
-
comparator = CCK::MessagesComparator.new(parsed_generated, parsed_original)
|
34
|
-
|
35
|
-
expect(comparator.errors).to be_empty, "There were comparison errors: #{comparator.errors}"
|
36
|
-
end
|
37
|
-
|
38
|
-
def parse_ndjson_file(path)
|
39
|
-
parse_ndjson(File.read(path))
|
40
|
-
end
|
41
|
-
|
42
|
-
def parse_ndjson(ndjson)
|
43
|
-
Cucumber::Messages::NdjsonToMessageEnumerator.new(ndjson)
|
44
|
-
end
|
45
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rspec'
|
4
|
-
require 'cucumber/messages'
|
5
|
-
require_relative '../../lib/keys_checker'
|
6
|
-
|
7
|
-
describe CCK::KeysChecker do
|
8
|
-
describe '#compare' do
|
9
|
-
let(:expected_values) { Cucumber::Messages::Attachment.new(url: 'https://foo.com', file_name: 'file.extension') }
|
10
|
-
let(:erroneous_values) { Cucumber::Messages::Attachment.new(source: '1', test_step_id: '123') }
|
11
|
-
let(:wrong_values) { Cucumber::Messages::Attachment.new(url: 'https://otherfoo.com', file_name: 'file.other') }
|
12
|
-
|
13
|
-
it 'finds missing keys' do
|
14
|
-
expect(described_class.compare(erroneous_values, expected_values)).to include(
|
15
|
-
'Missing keys in message Cucumber::Messages::Attachment: [:file_name, :url]'
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'finds extra keys' do
|
20
|
-
expect(described_class.compare(erroneous_values, expected_values)).to include(
|
21
|
-
'Detected extra keys in message Cucumber::Messages::Attachment: [:source, :test_step_id]'
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'finds extra and missing keys' do
|
26
|
-
expect(described_class.compare(erroneous_values, expected_values)).to contain_exactly(
|
27
|
-
'Missing keys in message Cucumber::Messages::Attachment: [:file_name, :url]',
|
28
|
-
'Detected extra keys in message Cucumber::Messages::Attachment: [:source, :test_step_id]'
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'does not care about the values' do
|
33
|
-
expect(described_class.compare(expected_values, wrong_values)).to be_empty
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'when default values are omitted' do
|
37
|
-
let(:default_set) { Cucumber::Messages::Duration.new(seconds: 0, nanos: 12) }
|
38
|
-
let(:default_not_set) { Cucumber::Messages::Duration.new(nanos: 12) }
|
39
|
-
|
40
|
-
it 'does not raise an exception' do
|
41
|
-
expect(described_class.compare(default_set, default_not_set)).to be_empty
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'when executed as part of a CI' do
|
46
|
-
before { allow(ENV).to receive(:[]).with('CI').and_return(true) }
|
47
|
-
|
48
|
-
it 'ignores actual CI related messages' do
|
49
|
-
detected = Cucumber::Messages::Meta.new(ci: Cucumber::Messages::Ci.new(name: 'Some CI'))
|
50
|
-
expected = Cucumber::Messages::Meta.new
|
51
|
-
|
52
|
-
expect(described_class.compare(detected, expected)).to be_empty
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'when an unexpected error occurs' do
|
57
|
-
it 'does not raise error' do
|
58
|
-
expect { described_class.compare(nil, nil) }.not_to raise_error
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'returns the error' do
|
62
|
-
expect(described_class.compare(nil, nil))
|
63
|
-
.to eq(['Unexpected error: wrong number of arguments (given 1, expected 0)'])
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rspec'
|
4
|
-
require 'cucumber/messages'
|
5
|
-
require_relative '../../lib/messages_comparator'
|
6
|
-
|
7
|
-
describe CCK::MessagesComparator do
|
8
|
-
context 'when executed as part of a CI' do
|
9
|
-
before { allow(ENV).to receive(:[]).with('CI').and_return(true) }
|
10
|
-
|
11
|
-
let(:ci_message) { Cucumber::Messages::Ci.new(name: 'Some CI') }
|
12
|
-
let(:blank_meta_message) { Cucumber::Messages::Meta.new }
|
13
|
-
let(:filled_meta_message) { Cucumber::Messages::Meta.new(ci: ci_message) }
|
14
|
-
let(:ci_message_envelope) { Cucumber::Messages::Envelope.new(meta: filled_meta_message) }
|
15
|
-
let(:meta_message_envelope) { Cucumber::Messages::Envelope.new(meta: blank_meta_message) }
|
16
|
-
|
17
|
-
it 'ignores any detected CI messages' do
|
18
|
-
comparator = described_class.new([ci_message_envelope], [meta_message_envelope])
|
19
|
-
|
20
|
-
expect(comparator.errors).to be_empty
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'ignores any expected CI messages' do
|
24
|
-
comparator = described_class.new([meta_message_envelope], [ci_message_envelope])
|
25
|
-
|
26
|
-
expect(comparator.errors).to be_empty
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cucumber-compatibility-kit'
|
4
|
-
|
5
|
-
describe Cucumber::CompatibilityKit do
|
6
|
-
let(:features_path) { File.expand_path("#{File.dirname(__FILE__)}/../../features") }
|
7
|
-
let(:gherkin_examples) do
|
8
|
-
%w[
|
9
|
-
attachments
|
10
|
-
cdata
|
11
|
-
data-tables
|
12
|
-
examples-tables
|
13
|
-
hooks
|
14
|
-
minimal
|
15
|
-
parameter-types
|
16
|
-
pending
|
17
|
-
retry
|
18
|
-
rules
|
19
|
-
skipped
|
20
|
-
stack-traces
|
21
|
-
undefined
|
22
|
-
unknown-parameter-type
|
23
|
-
]
|
24
|
-
end
|
25
|
-
let(:markdown_examples) { ['markdown'] }
|
26
|
-
|
27
|
-
describe '#examples_path' do
|
28
|
-
it 'returns the path of the features folder' do
|
29
|
-
expect(described_class.examples_path).to eq(features_path)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#example_path' do
|
34
|
-
context 'with an existing example' do
|
35
|
-
it 'returns the path of the folder of the example' do
|
36
|
-
expect(described_class.example_path('hooks')).to eq("#{features_path}/hooks")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'with an non-existent example' do
|
41
|
-
it 'raises ArgumentError' do
|
42
|
-
expect { described_class.example_path('should-not-exists') }.to raise_error(ArgumentError)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '#gherkin_examples' do
|
48
|
-
it 'returns the list of gherkin examples' do
|
49
|
-
expect(described_class.gherkin_examples).to match_array(gherkin_examples)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#markdown_examples' do
|
54
|
-
it 'returns the list of markdown examples' do
|
55
|
-
expect(described_class.markdown_examples).to match_array(markdown_examples)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#all_examples' do
|
60
|
-
it 'returns the list of all available examples' do
|
61
|
-
expect(described_class.all_examples)
|
62
|
-
.to match_array(gherkin_examples + markdown_examples)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|