cucumber-gherkin 27.0.0 → 32.2.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.
metadata CHANGED
@@ -1,85 +1,143 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-gherkin
3
3
  version: !ruby/object:Gem::Version
4
- version: 27.0.0
4
+ version: 32.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gáspár Nagy
8
8
  - Aslak Hellesøy
9
9
  - Steve Tooke
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2023-09-15 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: cucumber-messages
17
16
  requirement: !ruby/object:Gem::Requirement
18
17
  requirements:
19
- - - ">="
18
+ - - ">"
20
19
  - !ruby/object:Gem::Version
21
- version: 19.1.4
20
+ version: '25'
22
21
  - - "<"
23
22
  - !ruby/object:Gem::Version
24
- version: '23'
23
+ version: '28'
25
24
  type: :runtime
26
25
  prerelease: false
27
26
  version_requirements: !ruby/object:Gem::Requirement
28
27
  requirements:
29
- - - ">="
28
+ - - ">"
30
29
  - !ruby/object:Gem::Version
31
- version: 19.1.4
30
+ version: '25'
32
31
  - - "<"
33
32
  - !ruby/object:Gem::Version
34
- version: '23'
33
+ version: '28'
35
34
  - !ruby/object:Gem::Dependency
36
35
  name: rake
37
36
  requirement: !ruby/object:Gem::Requirement
38
37
  requirements:
39
38
  - - "~>"
40
39
  - !ruby/object:Gem::Version
41
- version: '13.0'
42
- - - ">="
40
+ version: '13.1'
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.1'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
43
53
  - !ruby/object:Gem::Version
44
- version: 13.0.6
54
+ version: '3.13'
45
55
  type: :development
46
56
  prerelease: false
47
57
  version_requirements: !ruby/object:Gem::Requirement
48
58
  requirements:
49
59
  - - "~>"
50
60
  - !ruby/object:Gem::Version
51
- version: '13.0'
52
- - - ">="
61
+ version: '3.13'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rubocop
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.71.2
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
53
74
  - !ruby/object:Gem::Version
54
- version: 13.0.6
75
+ version: 1.71.2
55
76
  - !ruby/object:Gem::Dependency
56
- name: rspec
77
+ name: rubocop-rspec
57
78
  requirement: !ruby/object:Gem::Requirement
58
79
  requirements:
59
80
  - - "~>"
60
81
  - !ruby/object:Gem::Version
61
- version: '3.11'
62
- - - ">="
82
+ version: 3.4.0
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
63
88
  - !ruby/object:Gem::Version
64
- version: 3.11.0
89
+ version: 3.4.0
90
+ - !ruby/object:Gem::Dependency
91
+ name: rubocop-packaging
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.5.2
65
97
  type: :development
66
98
  prerelease: false
67
99
  version_requirements: !ruby/object:Gem::Requirement
68
100
  requirements:
69
101
  - - "~>"
70
102
  - !ruby/object:Gem::Version
71
- version: '3.11'
72
- - - ">="
103
+ version: 0.5.2
104
+ - !ruby/object:Gem::Dependency
105
+ name: rubocop-performance
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.23.1
111
+ type: :development
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
73
116
  - !ruby/object:Gem::Version
74
- version: 3.11.0
117
+ version: 1.23.1
118
+ - !ruby/object:Gem::Dependency
119
+ name: rubocop-rake
120
+ requirement: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.6.0
125
+ type: :development
126
+ prerelease: false
127
+ version_requirements: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.6.0
75
132
  description: Gherkin parser
76
133
  email: cukes@googlegroups.com
77
134
  executables:
78
- - gherkin-ruby
79
135
  - gherkin
136
+ - gherkin-ruby
80
137
  extensions: []
81
138
  extra_rdoc_files: []
82
139
  files:
140
+ - LICENSE
83
141
  - README.md
84
142
  - bin/gherkin
85
143
  - bin/gherkin-ruby
@@ -98,13 +156,6 @@ files:
98
156
  - lib/gherkin/token_formatter_builder.rb
99
157
  - lib/gherkin/token_matcher.rb
100
158
  - lib/gherkin/token_scanner.rb
101
- - spec/capture_warnings.rb
102
- - spec/gherkin/dialect_spec.rb
103
- - spec/gherkin/gherkin_line_spec.rb
104
- - spec/gherkin/gherkin_spec.rb
105
- - spec/gherkin/parser_spec.rb
106
- - spec/gherkin/query_spec.rb
107
- - spec/gherkin/stream/parser_message_stream_spec.rb
108
159
  homepage: https://github.com/cucumber/gherkin
109
160
  licenses:
110
161
  - MIT
@@ -114,7 +165,6 @@ metadata:
114
165
  documentation_uri: https://cucumber.io/docs/gherkin/
115
166
  mailing_list_uri: https://groups.google.com/forum/#!forum/cukes
116
167
  source_code_uri: https://github.com/cucumber/gherkin/blob/main/ruby
117
- post_install_message:
118
168
  rdoc_options:
119
169
  - "--charset=UTF-8"
120
170
  require_paths:
@@ -123,22 +173,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
173
  requirements:
124
174
  - - ">="
125
175
  - !ruby/object:Gem::Version
126
- version: '2.5'
176
+ version: '3.2'
127
177
  required_rubygems_version: !ruby/object:Gem::Requirement
128
178
  requirements:
129
179
  - - ">="
130
180
  - !ruby/object:Gem::Version
131
- version: '0'
181
+ version: 3.2.8
132
182
  requirements: []
133
- rubygems_version: 3.4.10
134
- signing_key:
183
+ rubygems_version: 3.6.7
135
184
  specification_version: 4
136
- summary: cucumber-gherkin-27.0.0
137
- test_files:
138
- - spec/capture_warnings.rb
139
- - spec/gherkin/dialect_spec.rb
140
- - spec/gherkin/gherkin_line_spec.rb
141
- - spec/gherkin/gherkin_spec.rb
142
- - spec/gherkin/parser_spec.rb
143
- - spec/gherkin/query_spec.rb
144
- - spec/gherkin/stream/parser_message_stream_spec.rb
185
+ summary: cucumber-gherkin-32.2.0
186
+ test_files: []
@@ -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) }
10
-
11
- if errors.any?
12
- puts errors.join("\n")
13
- end
14
-
15
- if other_warnings.any?
16
- puts "#{ other_warnings.count } 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 } warnings detected"
27
- print_warnings('cucumber-expressions', project_warnings)
28
- fail "Please remove all cucumber-expressions 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
@@ -1,13 +0,0 @@
1
- # coding: utf-8
2
- require 'rspec'
3
- require 'gherkin/dialect'
4
-
5
- module Gherkin
6
- describe Dialect do
7
- it 'provides an interface to the keywords of a dialect' do
8
- dialect_en = Dialect.for('en')
9
-
10
- expect(dialect_en.feature_keywords).to eq(['Feature', 'Business Need', 'Ability'])
11
- end
12
- end
13
- end
@@ -1,36 +0,0 @@
1
- require 'rspec'
2
- require 'gherkin/gherkin_line'
3
-
4
- describe Gherkin::GherkinLine do
5
- context '#tags' do
6
- def tags(line)
7
- Gherkin::GherkinLine.new(line, 12).tags.map(&:text)
8
- end
9
-
10
- it 'allows any non-space characters in a tag' do
11
- expect(tags(" @foo:bar @zap🥒yo")).to eq(['@foo:bar', '@zap🥒yo'])
12
- end
13
- end
14
-
15
- context '#table_cells' do
16
- def cells_text(line)
17
- Gherkin::GherkinLine.new(line, 12).table_cells.map(&:text)
18
- end
19
-
20
- it 'trims white spaces before cell content' do
21
- expect(cells_text("| \t spaces before|")).to eq(['spaces before'])
22
- end
23
-
24
- it 'trims white spaces after cell content' do
25
- expect(cells_text("|spaces after |")).to eq(['spaces after'])
26
- end
27
-
28
- it 'trims white spaces around cell content' do
29
- expect(cells_text("| \t spaces everywhere \t|")).to eq(['spaces everywhere'])
30
- end
31
-
32
- it 'does not drop white spaces inside a cell' do
33
- expect(cells_text("| foo()\n bar\nbaz |")).to eq(["foo()\n bar\nbaz"])
34
- end
35
- end
36
- end
@@ -1,45 +0,0 @@
1
- require 'rspec'
2
- require 'gherkin'
3
-
4
- describe Gherkin do
5
- it "can process feature file paths" do
6
- messages = Gherkin.from_paths(
7
- ["../testdata/good/minimal.feature"],
8
- {include_source: true,
9
- include_gherkin_document: true,
10
- include_pickles: true}
11
- ).to_a
12
-
13
- expect(messages.length).to eq(3)
14
- end
15
-
16
- it "can process feature file content" do
17
- data = File.open("../testdata/good/minimal.feature", 'r:UTF-8', &:read)
18
-
19
- messages = Gherkin.from_source(
20
- "uri",
21
- data,
22
- {include_source: true,
23
- include_gherkin_document: true,
24
- include_pickles: true}
25
- ).to_a
26
-
27
- expect(messages.length).to eq(3)
28
- end
29
-
30
- it "can set the default dialect for the feature file content" do
31
- data = File.open("../testdata/good/i18n_no.feature", 'r:UTF-8', &:read)
32
- data_without_language_header = data.split("\n")[1..-1].join("\n")
33
-
34
- messages = Gherkin.from_source(
35
- "uri",
36
- data,
37
- {include_source: true,
38
- include_gherkin_document: true,
39
- include_pickles: true,
40
- default_dialect: "no"}
41
- ).to_a
42
-
43
- expect(messages.length).to eq(3)
44
- end
45
- end
@@ -1,10 +0,0 @@
1
- require 'rspec'
2
- require 'gherkin'
3
-
4
- describe Gherkin::Parser do
5
- context '.new' do
6
- it 'can be invoked with no args' do
7
- Gherkin::Parser.new
8
- end
9
- end
10
- end
@@ -1,208 +0,0 @@
1
- require 'rspec'
2
- require 'gherkin'
3
- require 'gherkin/query'
4
-
5
- describe Gherkin::Query do
6
- let(:subject) { Gherkin::Query.new }
7
-
8
- def filter_messages_by_attribute(messages, attribute)
9
- messages.map do |message|
10
- return unless message.respond_to?(attribute)
11
- message.send(attribute)
12
- end.compact
13
- end
14
-
15
- def find_message_by_attribute(messages, attribute)
16
- filter_messages_by_attribute(messages, attribute).first
17
- end
18
-
19
- let(:gherkin_document) { find_message_by_attribute(messages, :gherkin_document) }
20
-
21
- let(:messages) do
22
- Gherkin.from_source(
23
- "some/path",
24
- feature_content,
25
- {
26
- include_gherkin_document: true
27
- }
28
- ).to_a
29
- end
30
-
31
- let(:feature_content) do
32
- """
33
- @feature-tag
34
- Feature: my feature
35
-
36
- Background:
37
- Given a passed background step
38
-
39
- @scenario-tag
40
- Scenario: my scenario
41
- Given a passed step
42
-
43
- Scenario Outline: with examples
44
- Given a <Status> step
45
-
46
- @examples-tag
47
- Examples:
48
- | Status |
49
- | passed |
50
- | failed |
51
-
52
- @rule-tag
53
- Rule: this is a rule
54
- Background:
55
- Given the passed step in the rule background
56
-
57
- @ruled-scenario-tag
58
- Scenario: a ruled scenario
59
- Given a step in the ruled scenario
60
- """
61
- end
62
-
63
- describe '#update' do
64
- context 'when the feature file is empty' do
65
- let(:feature_content) { '' }
66
-
67
- it 'does not fail' do
68
- expect do
69
- messages.each { |message| subject.update(message) }
70
- end.not_to raise_exception
71
- end
72
- end
73
- end
74
-
75
- describe '#scenario_parent_locations' do
76
- before do
77
- messages.each { |message| subject.update(message) }
78
- end
79
-
80
- let(:background) { find_message_by_attribute(gherkin_document.feature.children, :background) }
81
- let(:scenarios) { filter_messages_by_attribute(gherkin_document.feature.children, :scenario) }
82
-
83
- context 'without rule' do
84
- let(:scenario) { scenarios.first }
85
-
86
- it 'provides the feature and background locations of a given scenario node id' do
87
- expect(subject.scenario_parent_locations(scenario.id)).to eq([
88
- gherkin_document.feature.location,
89
- background.location,
90
- ])
91
- end
92
- end
93
-
94
- context 'with rule' do
95
- let(:rule) { find_message_by_attribute(gherkin_document.feature.children, :rule) }
96
- let(:rule_background) { find_message_by_attribute(rule.children, :background) }
97
- let(:scenario) { find_message_by_attribute(rule.children, :scenario) }
98
-
99
- it 'provides the feature, background, rule, and rule background locations of a given scenario node id' do
100
- expect(subject.scenario_parent_locations(scenario.id)).to eq([
101
- gherkin_document.feature.location,
102
- background.location,
103
- rule.location,
104
- rule_background.location,
105
- ])
106
- end
107
- end
108
-
109
- context 'in a scenario outline' do
110
- let(:scenario) { scenarios.last }
111
-
112
- it 'provides the feature and background locations of a given scenario outline node id' do
113
- expect(subject.scenario_parent_locations(scenario.id)).to eq([
114
- gherkin_document.feature.location,
115
- background.location,
116
- ])
117
- end
118
- end
119
-
120
- it 'raises an exception if called with an invalid id' do
121
- expect { subject.scenario_parent_locations("BAD") }.to raise_error(Gherkin::AstNodeNotLocatedException)
122
- end
123
- end
124
-
125
- describe '#location' do
126
- before do
127
- messages.each { |message| subject.update(message) }
128
- end
129
-
130
- let(:background) { find_message_by_attribute(gherkin_document.feature.children, :background) }
131
- let(:rule) { find_message_by_attribute(gherkin_document.feature.children, :rule) }
132
- let(:scenarios) { filter_messages_by_attribute(gherkin_document.feature.children, :scenario) }
133
- let(:scenario) { scenarios.first }
134
-
135
- it 'raises an exception when the AST node ID is unknown' do
136
- expect { subject.location("this-id-may-not-exist-for-real") }.to raise_exception(Gherkin::AstNodeNotLocatedException)
137
- end
138
-
139
- it 'provides the location of a scenario' do
140
- expect(subject.location(scenario.id)).to eq(scenario.location)
141
- end
142
-
143
- it 'provides the location of an examples table row' do
144
- node = scenarios.last.examples.first.table_body.first
145
- expect(subject.location(node.id)).to eq(node.location)
146
- end
147
-
148
- context 'when querying steps' do
149
- let(:background_step) { background.steps.first }
150
- let(:scenario_step) { scenario.steps.first }
151
-
152
- it 'provides the location of a background step' do
153
- expect(subject.location(background_step.id)).to eq(background_step.location)
154
- end
155
-
156
- it 'provides the location of a scenario step' do
157
- expect(subject.location(scenario_step.id)).to eq(scenario_step.location)
158
- end
159
- end
160
-
161
- context 'when querying tags' do
162
- let(:feature_tag) { gherkin_document.feature.tags.first }
163
- let(:rule_tag) { rule.tags.first }
164
- let(:scenario_tag) { scenario.tags.first }
165
- let(:examples_tag) { scenarios.last.examples.first.tags.first }
166
-
167
- it 'provides the location of a feature tags' do
168
- expect(subject.location(feature_tag.id)).to eq(feature_tag.location)
169
- end
170
-
171
- it 'provides the location of a scenario tags' do
172
- expect(subject.location(scenario_tag.id)).to eq(scenario_tag.location)
173
- end
174
-
175
- it 'provides the location of scenario examples tags' do
176
- expect(subject.location(examples_tag.id)).to eq(examples_tag.location)
177
- end
178
-
179
- it 'provides the location of a rule tag' do
180
- expect(subject.location(rule_tag.id)).to eq(rule_tag.location)
181
- end
182
- end
183
-
184
- context 'when children are scoped in a Rule' do
185
- let(:rule_background) { find_message_by_attribute(rule.children, :background) }
186
- let(:rule_background_step) { rule_background.steps.first }
187
- let(:rule_scenario) { find_message_by_attribute(rule.children, :scenario) }
188
- let(:rule_scenario_step) { rule_scenario.steps.first }
189
- let(:rule_scenario_tag) { rule_scenario.tags.first }
190
-
191
- it 'provides the location of a background step' do
192
- expect(subject.location(rule_background_step.id)).to eq(rule_background_step.location)
193
- end
194
-
195
- it 'provides the location of a scenario' do
196
- expect(subject.location(rule_scenario.id)).to eq(rule_scenario.location)
197
- end
198
-
199
- it 'provides the location of a scenario tag' do
200
- expect(subject.location(rule_scenario_tag.id)).to eq(rule_scenario_tag.location)
201
- end
202
-
203
- it 'provides the location of a scenario step' do
204
- expect(subject.location(rule_scenario_step.id)).to eq(rule_scenario_step.location)
205
- end
206
- end
207
- end
208
- end
@@ -1,67 +0,0 @@
1
- require 'rspec'
2
- require 'gherkin/stream/parser_message_stream'
3
-
4
- module Gherkin
5
- module Stream
6
- describe ParserMessageStream do
7
- let(:feature_content) {
8
- "Feature: my feature\n" \
9
- " Scenario: a scenario\n" \
10
- " Given some context"
11
- }
12
-
13
- let(:source_feature) {
14
- Cucumber::Messages::Source.new(
15
- uri: '//whatever/uri',
16
- data: feature_content,
17
- media_type: 'text/x.cucumber.gherkin+plain'
18
- )
19
- }
20
-
21
- let(:options) {
22
- {
23
- include_gherkin_document: true,
24
- }
25
- }
26
-
27
- let(:gherkin_document) {
28
- ParserMessageStream.new([], [source_feature], options).messages.first.gherkin_document
29
- }
30
-
31
- let(:scenario_id) { gherkin_document.feature.children.first.scenario.id }
32
-
33
- context '#messages' do
34
- it "raises an exception on second iteration" do
35
- messages = ParserMessageStream.new([], [source_feature], options).messages
36
-
37
- expect { messages.map(&:to_s) }.not_to raise_exception
38
- expect { messages.map(&:to_s) }.to raise_exception(Gherkin::DoubleIterationException)
39
- end
40
- end
41
-
42
- context 'options.id_generator' do
43
- context 'when not set' do
44
- it 'generates random UUIDs' do
45
- expect(scenario_id).to match(/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/)
46
- end
47
- end
48
-
49
-
50
- context 'when set' do
51
- let(:id_generator) { double }
52
- let(:options) {
53
- {
54
- include_gherkin_document: true,
55
- id_generator: id_generator
56
- }
57
- }
58
-
59
- it 'uses the generator instance to produce the IDs' do
60
- allow(id_generator).to receive(:new_id).and_return('some-random-id')
61
- expect(scenario_id).to eq('some-random-id')
62
- end
63
- end
64
- end
65
- end
66
- end
67
- end