cucumber-compatibility-kit 13.0.1 → 14.0.0

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/features/attachments/attachments.feature +16 -12
  3. data/features/attachments/attachments.feature.ndjson +97 -80
  4. data/features/attachments/attachments.feature.rb +4 -12
  5. data/features/cdata/cdata.feature +0 -1
  6. data/features/cdata/cdata.feature.ndjson +4 -4
  7. data/features/cdata/cdata.feature.rb +5 -0
  8. data/features/data-tables/data-tables.feature +4 -3
  9. data/features/data-tables/data-tables.feature.ndjson +3 -3
  10. data/features/examples-tables/examples-tables.feature +4 -5
  11. data/features/examples-tables/examples-tables.feature.ndjson +11 -11
  12. data/features/hooks/hooks.feature +9 -8
  13. data/features/hooks/hooks.feature.ndjson +18 -18
  14. data/features/hooks/hooks.feature.rb +4 -4
  15. data/features/markdown/markdown.feature.md.ndjson +1 -1
  16. data/features/minimal/minimal.feature.ndjson +2 -2
  17. data/features/minimal/minimal.feature.rb +2 -1
  18. data/features/parameter-types/parameter-types.feature +8 -6
  19. data/features/parameter-types/parameter-types.feature.ndjson +6 -6
  20. data/features/parameter-types/parameter-types.feature.rb +2 -3
  21. data/features/pending/pending.feature +5 -6
  22. data/features/pending/pending.feature.ndjson +12 -12
  23. data/features/pending/pending.feature.rb +4 -4
  24. data/features/retry/retry.feature +7 -8
  25. data/features/retry/retry.feature.ndjson +14 -14
  26. data/features/retry/retry.feature.rb +3 -7
  27. data/features/rules/rules.feature +23 -21
  28. data/features/rules/rules.feature.ndjson +46 -44
  29. data/features/rules/rules.feature.rb +12 -15
  30. data/features/skipped/skipped.feature.ndjson +1 -1
  31. data/features/stack-traces/stack-traces.feature.ndjson +1 -1
  32. data/features/undefined/undefined.feature.ndjson +1 -1
  33. data/features/unknown-parameter-type/unknown-parameter-type.feature.ndjson +1 -1
  34. data/lib/cck/messages_comparator.rb +11 -11
  35. data/lib/cucumber/cucumber-compatibility-kit.rb +35 -37
  36. data/lib/cucumber-compatibility-kit.rb +2 -0
  37. data/lib/keys_checker.rb +2 -0
  38. data/lib/messages_comparator.rb +2 -0
  39. data/lib/shared_examples.rb +2 -2
  40. data/spec/cck/messages_comparator_spec.rb +2 -2
  41. data/spec/cucumber/cucumber-compatibility-kit_spec.rb +15 -15
  42. metadata +4 -3
@@ -7,16 +7,12 @@ module CCK
7
7
  class MessagesComparator
8
8
  include Helpers
9
9
 
10
- def initialize(validator, detected, expected)
11
- @all_errors = []
12
- @compared = []
13
- @validator = validator
14
-
10
+ def initialize(detected, expected)
15
11
  compare(detected, expected)
16
12
  end
17
13
 
18
14
  def errors
19
- @all_errors.flatten
15
+ all_errors.flatten
20
16
  end
21
17
 
22
18
  private
@@ -25,10 +21,10 @@ module CCK
25
21
  detected_by_type = messages_by_type(detected)
26
22
  expected_by_type = messages_by_type(expected)
27
23
 
28
- detected_by_type.keys.each do |type|
24
+ detected_by_type.each_key do |type|
29
25
  compare_list(detected_by_type[type], expected_by_type[type])
30
26
  rescue StandardError => e
31
- @all_errors << "Error while comparing #{type}: #{e.message}"
27
+ all_errors << "Error while comparing #{type}: #{e.message}"
32
28
  end
33
29
  end
34
30
 
@@ -55,8 +51,7 @@ module CCK
55
51
  return if ignorable?(detected)
56
52
  return if incomparable?(detected)
57
53
 
58
- @all_errors << @validator.compare(detected, expected)
59
- @compared << detected.class.name
54
+ all_errors << CCK::KeysChecker.compare(detected, expected)
60
55
  compare_sub_messages(detected, expected)
61
56
  end
62
57
 
@@ -84,7 +79,8 @@ module CCK
84
79
 
85
80
  def compare_sub_messages(detected, expected)
86
81
  return unless expected.respond_to? :to_h
87
- expected.to_h.keys.each do |key|
82
+
83
+ expected.to_h.each_key do |key|
88
84
  value = expected.send(key)
89
85
  if value.is_a?(Array)
90
86
  compare_list(detected.send(key), value)
@@ -93,5 +89,9 @@ module CCK
93
89
  end
94
90
  end
95
91
  end
92
+
93
+ def all_errors
94
+ @all_errors ||= []
95
+ end
96
96
  end
97
97
  end
@@ -2,56 +2,54 @@
2
2
 
3
3
  require 'shared_examples'
4
4
 
5
- module Cucumber::CompatibilityKit
6
- class << self
7
- def all_examples
8
- gherkin_examples + markdown_examples
9
- end
5
+ module Cucumber
6
+ module CompatibilityKit
7
+ class << self
8
+ def all_examples
9
+ gherkin_examples + markdown_examples
10
+ end
10
11
 
11
- def gherkin_examples
12
- Dir
13
- .entries(examples_path)
14
- .select do |file|
15
- folder = File.join(examples_path, file)
12
+ def gherkin_examples
13
+ Dir.entries(examples_path).select do |file_or_folder|
14
+ next if file_or_folder.start_with?('.')
16
15
 
17
- file != '.' && file != '..' &&
18
- File.directory?(folder) &&
19
- gherkin_example?(folder)
16
+ gherkin_example?(File.join(examples_path, file_or_folder))
20
17
  end
21
- end
18
+ end
22
19
 
23
- def markdown_examples
24
- Dir
25
- .entries(examples_path)
26
- .select do |file|
27
- folder = File.join(examples_path, file)
20
+ def markdown_examples
21
+ Dir.entries(examples_path).select do |file_or_folder|
22
+ next if file_or_folder.start_with?('.')
28
23
 
29
- file != '.' && file != '..' &&
30
- File.directory?(folder) &&
31
- markdown_example?(folder)
24
+ markdown_example?(File.join(examples_path, file_or_folder))
25
+ end
32
26
  end
33
- end
34
27
 
35
- def examples_path
36
- File.expand_path("#{File.dirname(__FILE__)}/../../features/")
37
- end
28
+ def examples_path
29
+ File.expand_path("#{File.dirname(__FILE__)}/../../features/")
30
+ end
38
31
 
39
- def example_path(example_name)
40
- path = File.join(examples_path, example_name)
32
+ def example_path(example_name)
33
+ path = File.join(examples_path, example_name)
41
34
 
42
- return path if File.directory?(path)
35
+ return path if File.directory?(path)
43
36
 
44
- raise ArgumentError.new
45
- end
37
+ raise ArgumentError, "No CCK example exists for #{example_name}"
38
+ end
46
39
 
47
- private
40
+ private
48
41
 
49
- def gherkin_example?(example_folder)
50
- Dir.entries(example_folder).select { |file| File.extname(file) == '.feature' }.count > 0
51
- end
42
+ def gherkin_example?(example_folder)
43
+ file_type_in_folder?('.feature', example_folder)
44
+ end
52
45
 
53
- def markdown_example?(example_folder)
54
- Dir.entries(example_folder).select { |file| File.extname(file) == '.md' }.count > 0
46
+ def markdown_example?(example_folder)
47
+ file_type_in_folder?('.md', example_folder)
48
+ end
49
+
50
+ def file_type_in_folder?(extension, folder)
51
+ Dir.entries(folder).any? { |file| File.extname(file) == extension }
52
+ end
55
53
  end
56
54
  end
57
55
  end
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'cucumber/cucumber-compatibility-kit'
data/lib/keys_checker.rb CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'cck/keys_checker'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'cck/messages_comparator'
@@ -10,7 +10,7 @@ require 'keys_checker'
10
10
  RSpec.shared_examples 'cucumber compatibility kit' do
11
11
  include CCK::Helpers
12
12
 
13
- # Note: to use those examples, you need to define:
13
+ # NOTE: to use those examples, you need to define:
14
14
  # let(:example) { } # the name of the example to test
15
15
  # let(:messages) { } # the messages to validate
16
16
 
@@ -30,7 +30,7 @@ RSpec.shared_examples 'cucumber compatibility kit' do
30
30
  end
31
31
 
32
32
  it 'generates valid message structure' do
33
- comparator = CCK::MessagesComparator.new(CCK::KeysChecker, parsed_generated, parsed_original)
33
+ comparator = CCK::MessagesComparator.new(parsed_generated, parsed_original)
34
34
 
35
35
  expect(comparator.errors).to be_empty, "There were comparison errors: #{comparator.errors}"
36
36
  end
@@ -15,13 +15,13 @@ describe CCK::MessagesComparator do
15
15
  let(:meta_message_envelope) { Cucumber::Messages::Envelope.new(meta: blank_meta_message) }
16
16
 
17
17
  it 'ignores any detected CI messages' do
18
- comparator = described_class.new(CCK::KeysChecker, [ci_message_envelope], [meta_message_envelope])
18
+ comparator = described_class.new([ci_message_envelope], [meta_message_envelope])
19
19
 
20
20
  expect(comparator.errors).to be_empty
21
21
  end
22
22
 
23
23
  it 'ignores any expected CI messages' do
24
- comparator = described_class.new(CCK::KeysChecker, [meta_message_envelope], [ci_message_envelope])
24
+ comparator = described_class.new([meta_message_envelope], [ci_message_envelope])
25
25
 
26
26
  expect(comparator.errors).to be_empty
27
27
  end
@@ -5,21 +5,21 @@ require 'cucumber-compatibility-kit'
5
5
  describe Cucumber::CompatibilityKit do
6
6
  let(:features_path) { File.expand_path("#{File.dirname(__FILE__)}/../../features") }
7
7
  let(:gherkin_examples) do
8
- [
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'
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
23
  ]
24
24
  end
25
25
  let(:markdown_examples) { ['markdown'] }
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: 13.0.1
4
+ version: 14.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aurélien Reeves
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2023-10-11 00:00:00.000000000 Z
14
+ date: 2023-11-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cucumber-messages
@@ -138,6 +138,7 @@ files:
138
138
  - features/attachments/document.pdf
139
139
  - features/cdata/cdata.feature
140
140
  - features/cdata/cdata.feature.ndjson
141
+ - features/cdata/cdata.feature.rb
141
142
  - features/data-tables/data-tables.feature
142
143
  - features/data-tables/data-tables.feature.ndjson
143
144
  - features/data-tables/data-tables.feature.rb
@@ -217,7 +218,7 @@ requirements: []
217
218
  rubygems_version: 3.4.10
218
219
  signing_key:
219
220
  specification_version: 4
220
- summary: cucumber-compatibility-kit-13.0.1
221
+ summary: cucumber-compatibility-kit-14.0.0
221
222
  test_files:
222
223
  - spec/cck/keys_checker_spec.rb
223
224
  - spec/cck/messages_comparator_spec.rb