cucumber-gherkin 11.0.0 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8ef7f391b248337dc3a37648951be4a44c017a8f1f21a7bf7d077d74f5c8f5e
4
- data.tar.gz: ae2514cd26d8a868d25bf62f01bf9b8e8dfe9b8549c22fd9cfa52d9a8a948fc6
3
+ metadata.gz: 8d52d0c5ccf99360cc6620cc0d81fa7bfaf74d058d7922c7dcd3bb5a5ac4bd52
4
+ data.tar.gz: de54e5009f7001b4e3c9c838fab6cffd5ee4d86f52e63ade6894d451e29e471c
5
5
  SHA512:
6
- metadata.gz: 81a73d362301d0dfa341137e973452e54ca403d21544d9c031cb068b6ba6df24ab463057f3dfbbb7921158df97d5a3f372ac0ae15eb1b1181eb28c6c4f7d486e
7
- data.tar.gz: 023d8fbd0d1dd1300caf12237fb2e5fcc3dc1068b0d49a577a136d8ce9d03783c6e1ac59b97391ac1a9afad0d4e7d4cd61ec148a60b6b2744dc6b4aa6925dd6e
6
+ metadata.gz: 49148577aa1f5221bd837ebf0d4e93699f112a04edd54f4bcfee4cf2b7aab8287a39625f555e029334a27e6da754e39a659a4c91212ba92eb84e0c6d1b0437cf
7
+ data.tar.gz: 929be4669eab80e0a307465c1192258d1f0a7469a21ebc665027389312084a2ff77b0494abeb2304ff5a05df35cdda657be408c746c1f9fc95ecfc3d68795cca
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://secure.travis-ci.org/cucumber/gherkin-ruby.svg)](http://travis-ci.org/cucumber/gherkin-ruby)
1
+ # Gherkin for Ruby
2
2
 
3
3
  Gherkin parser/compiler for Ruby. Please see [Gherkin](https://github.com/cucumber/gherkin) for details.
4
4
 
@@ -1,4 +1,4 @@
1
- require 'gherkin/stream/parser_message_stream'
1
+ require_relative 'gherkin/stream/parser_message_stream'
2
2
 
3
3
  module Gherkin
4
4
  DEFAULT_OPTIONS = {
@@ -1,5 +1,5 @@
1
1
  require 'cucumber/messages'
2
- require 'gherkin/ast_node'
2
+ require_relative 'ast_node'
3
3
 
4
4
  module Gherkin
5
5
  class AstBuilder
@@ -146,6 +146,7 @@ module Gherkin
146
146
  steps = get_steps(node)
147
147
 
148
148
  Cucumber::Messages::GherkinDocument::Feature::Background.new(
149
+ id: @id_generator.new_id,
149
150
  location: get_location(background_line, 0),
150
151
  keyword: background_line.matched_keyword,
151
152
  name: background_line.matched_text,
@@ -180,6 +181,7 @@ module Gherkin
180
181
  table_body = rows.nil? ? nil : rows[1..-1]
181
182
 
182
183
  Cucumber::Messages::GherkinDocument::Feature::Scenario::Examples.new(
184
+ id: @id_generator.new_id,
183
185
  tags: tags,
184
186
  location: get_location(examples_line, 0),
185
187
  keyword: examples_line.matched_keyword,
@@ -237,6 +239,7 @@ module Gherkin
237
239
  description = get_description(header)
238
240
 
239
241
  Cucumber::Messages::GherkinDocument::Feature::FeatureChild::Rule.new(
242
+ id: @id_generator.new_id,
240
243
  location: get_location(rule_line, 0),
241
244
  keyword: rule_line.matched_keyword,
242
245
  name: rule_line.matched_text,
@@ -1133,14 +1133,14 @@
1133
1133
  "name": "Estonian",
1134
1134
  "native": "eesti keel",
1135
1135
  "rule": [
1136
- "Rule"
1136
+ "Reegel"
1137
1137
  ],
1138
1138
  "scenario": [
1139
1139
  "Juhtum",
1140
1140
  "Stsenaarium"
1141
1141
  ],
1142
1142
  "scenarioOutline": [
1143
- "Raamstjuhtum",
1143
+ "Raamjuhtum",
1144
1144
  "Raamstsenaarium"
1145
1145
  ],
1146
1146
  "then": [
@@ -1471,7 +1471,7 @@
1471
1471
  "name": "Hebrew",
1472
1472
  "native": "עברית",
1473
1473
  "rule": [
1474
- "Rule"
1474
+ "כלל"
1475
1475
  ],
1476
1476
  "scenario": [
1477
1477
  "דוגמא",
@@ -2729,7 +2729,7 @@
2729
2729
  "name": "Russian",
2730
2730
  "native": "русский",
2731
2731
  "rule": [
2732
- "Rule"
2732
+ "Правило"
2733
2733
  ],
2734
2734
  "scenario": [
2735
2735
  "Пример",
@@ -3622,4 +3622,4 @@
3622
3622
  "जेव्हा "
3623
3623
  ]
3624
3624
  }
3625
- }
3625
+ }
@@ -1,8 +1,8 @@
1
1
  # This file is generated. Do not edit! Edit gherkin-ruby.razor instead.
2
- require 'gherkin/ast_builder'
3
- require 'gherkin/token_matcher'
4
- require 'gherkin/token_scanner'
5
- require 'gherkin/errors'
2
+ require_relative 'ast_builder'
3
+ require_relative 'token_matcher'
4
+ require_relative 'token_scanner'
5
+ require_relative 'errors'
6
6
 
7
7
  module Gherkin
8
8
 
@@ -56,7 +56,7 @@ module Gherkin
56
56
  class Parser
57
57
  attr_accessor :stop_at_first_error
58
58
 
59
- def initialize(ast_builder = AstBuilder.new)
59
+ def initialize(ast_builder = AstBuilder.new(Cucumber::Messages::IdGenerator::UUID.new))
60
60
  @ast_builder = ast_builder
61
61
  end
62
62
 
@@ -16,6 +16,7 @@ module Gherkin
16
16
  private
17
17
 
18
18
  def update_feature(feature)
19
+ return if feature.nil?
19
20
  store_nodes_location(feature.tags)
20
21
 
21
22
  feature.children.each do |child|
@@ -1,7 +1,7 @@
1
1
  require 'cucumber/messages'
2
- require 'gherkin/parser'
3
- require 'gherkin/token_matcher'
4
- require 'gherkin/pickles/compiler'
2
+ require_relative '../parser'
3
+ require_relative '../token_matcher'
4
+ require_relative '../pickles/compiler'
5
5
 
6
6
  module Gherkin
7
7
  module Stream
@@ -39,9 +39,9 @@ module Gherkin
39
39
  end
40
40
  end
41
41
  rescue CompositeParserException => err
42
- yield_error_attachments(y, err.errors, source.uri)
42
+ yield_parse_errors(y, err.errors, source.uri)
43
43
  rescue ParserException => err
44
- yield_error_attachments(y, [err], source.uri)
44
+ yield_parse_errors(y, [err], source.uri)
45
45
  end
46
46
  end
47
47
  end
@@ -49,9 +49,9 @@ module Gherkin
49
49
 
50
50
  private
51
51
 
52
- def yield_error_attachments(y, errors, uri)
52
+ def yield_parse_errors(y, errors, uri)
53
53
  errors.each do |err|
54
- attachment = Cucumber::Messages::Attachment.new(
54
+ parse_error = Cucumber::Messages::ParseError.new(
55
55
  source: Cucumber::Messages::SourceReference.new(
56
56
  uri: uri,
57
57
  location: Cucumber::Messages::Location.new(
@@ -59,9 +59,9 @@ module Gherkin
59
59
  column: err.location[:column]
60
60
  )
61
61
  ),
62
- text: err.message
62
+ message: err.message
63
63
  )
64
- y.yield(Cucumber::Messages::Envelope.new(attachment: attachment))
64
+ y.yield(Cucumber::Messages::Envelope.new(parse_error: parse_error))
65
65
  end
66
66
  end
67
67
 
@@ -1,5 +1,5 @@
1
- require 'gherkin/dialect'
2
- require 'gherkin/errors'
1
+ require_relative 'dialect'
2
+ require_relative 'errors'
3
3
 
4
4
  module Gherkin
5
5
  class TokenMatcher
@@ -1,6 +1,6 @@
1
1
  require 'stringio'
2
- require 'gherkin/token'
3
- require 'gherkin/gherkin_line'
2
+ require_relative 'token'
3
+ require_relative 'gherkin_line'
4
4
 
5
5
  module Gherkin
6
6
  # The scanner reads a gherkin doc (typically read from a .feature file) and
@@ -0,0 +1,26 @@
1
+ require 'rspec'
2
+ require 'gherkin/gherkin_line'
3
+
4
+ describe Gherkin::GherkinLine do
5
+ context '#table_cell' do
6
+ def cells_text(line)
7
+ Gherkin::GherkinLine.new(line, 12).table_cells.map(&:text)
8
+ end
9
+
10
+ it 'trims white spaces before cell content' do
11
+ expect(cells_text("| \t spaces before|")).to eq(['spaces before'])
12
+ end
13
+
14
+ it 'trims white spaces after cell content' do
15
+ expect(cells_text("|spaces after |")).to eq(['spaces after'])
16
+ end
17
+
18
+ it 'trims white spaces around cell content' do
19
+ expect(cells_text("| \t spaces everywhere \t|")).to eq(['spaces everywhere'])
20
+ end
21
+
22
+ it 'does not drop white spaces inside a cell' do
23
+ expect(cells_text("| foo()\n bar\nbaz |")).to eq(["foo()\n bar\nbaz"])
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,10 @@
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
@@ -59,13 +59,27 @@ describe Gherkin::Query do
59
59
  """
60
60
  }
61
61
 
62
- before do
63
- messages.each { |message|
64
- subject.update(message)
65
- }
62
+ context '#update' do
63
+ context 'when the feature file is empty' do
64
+ let(:feature_content) { '' }
65
+
66
+ it 'does not fail' do
67
+ expect {
68
+ messages.each { |message|
69
+ subject.update(message)
70
+ }
71
+ }.not_to raise_exception
72
+ end
73
+ end
66
74
  end
67
75
 
68
76
  context '#location' do
77
+ before do
78
+ messages.each { |message|
79
+ subject.update(message)
80
+ }
81
+ end
82
+
69
83
  let(:background) { find_message_by_attribute(gherkin_document.feature.children, :background) }
70
84
  let(:scenarios) { filter_messages_by_attribute(gherkin_document.feature.children, :scenario) }
71
85
  let(:scenario) { scenarios.first }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-gherkin
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.0
4
+ version: 14.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gáspár Nagy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-03-02 00:00:00.000000000 Z
13
+ date: 2020-07-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber-messages
@@ -18,20 +18,20 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '10.0'
21
+ version: '12.3'
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 10.0.1
24
+ version: 12.3.2
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
29
  - - "~>"
30
30
  - !ruby/object:Gem::Version
31
- version: '10.0'
31
+ version: '12.3'
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 10.0.1
34
+ version: 12.3.2
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rake
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -102,7 +102,9 @@ files:
102
102
  - lib/gherkin/token_scanner.rb
103
103
  - spec/capture_warnings.rb
104
104
  - spec/gherkin/dialect_spec.rb
105
+ - spec/gherkin/gherkin_line_spec.rb
105
106
  - spec/gherkin/gherkin_spec.rb
107
+ - spec/gherkin/parser_spec.rb
106
108
  - spec/gherkin/query_spec.rb
107
109
  - spec/gherkin/stream/parser_message_stream_spec.rb
108
110
  - spec/gherkin/stream/subprocess_message_stream_spec.rb
@@ -131,15 +133,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
133
  - !ruby/object:Gem::Version
132
134
  version: '0'
133
135
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.7.6.2
136
+ rubygems_version: 3.1.2
136
137
  signing_key:
137
138
  specification_version: 4
138
- summary: cucumber-gherkin-11.0.0
139
+ summary: cucumber-gherkin-14.1.0
139
140
  test_files:
140
141
  - spec/gherkin/dialect_spec.rb
142
+ - spec/gherkin/gherkin_line_spec.rb
141
143
  - spec/gherkin/stream/parser_message_stream_spec.rb
142
144
  - spec/gherkin/stream/subprocess_message_stream_spec.rb
145
+ - spec/gherkin/parser_spec.rb
143
146
  - spec/gherkin/gherkin_spec.rb
144
147
  - spec/gherkin/query_spec.rb
145
148
  - spec/capture_warnings.rb