cucumber-gherkin 28.0.0 → 29.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/bin/gherkin +10 -10
- data/lib/gherkin/gherkin-languages.json +23 -24
- data/lib/gherkin/gherkin_line.rb +1 -1
- data/lib/gherkin/parser.rb +1 -1
- data/lib/gherkin/stream/parser_message_stream.rb +1 -1
- metadata +31 -42
- data/spec/capture_warnings.rb +0 -74
- data/spec/gherkin/dialect_spec.rb +0 -13
- data/spec/gherkin/gherkin_line_spec.rb +0 -36
- data/spec/gherkin/gherkin_spec.rb +0 -45
- data/spec/gherkin/parser_spec.rb +0 -10
- data/spec/gherkin/query_spec.rb +0 -208
- data/spec/gherkin/stream/parser_message_stream_spec.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb339971170bdf897bf51a6d7cc8e63fee16894e19c4ef4473338019c74210e4
|
4
|
+
data.tar.gz: 90052ec9d9cff63eaca6f7d0a69b86e898e0c32f6ad04952d7bdf39904070cec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8afa90ac6ba2c8b4730e64038d3a6e7c733698e8b10c1e10dbd6f82356fab0baa679944aa3c4aadf850f77aba270f28b53dc3fd72137e64785cc4aecfee980af
|
7
|
+
data.tar.gz: bd312859d9a2b2c1dc5ae2bcd9ae19b527e83d1f0a645a3f8e60f913f08552f9f6629ac7840d6950263859bf7ace7ee58f3c8221586ca1f2e0ef1d9ca2266723
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Cucumber Ltd, Gaspar Nagy, Björn Rasmusson, Peter Sergeant, and contributors
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/bin/gherkin
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),"../lib"))
|
4
4
|
|
5
5
|
require 'optparse'
|
@@ -15,17 +15,17 @@ options = {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
OptionParser.new do |opts|
|
18
|
-
opts.on(
|
19
|
-
options[:include_source] =
|
18
|
+
opts.on('--[no-]source', "Don't print source messages") do |value|
|
19
|
+
options[:include_source] = value
|
20
20
|
end
|
21
|
-
opts.on(
|
22
|
-
options[:include_gherkin_document] =
|
21
|
+
opts.on('--[no-]ast', "Don't print ast messages") do |value|
|
22
|
+
options[:include_gherkin_document] = value
|
23
23
|
end
|
24
|
-
opts.on(
|
25
|
-
options[:include_pickles] =
|
24
|
+
opts.on('--[no-]pickles', "Don't print pickle messages") do |value|
|
25
|
+
options[:include_pickles] = value
|
26
26
|
end
|
27
|
-
opts.on(
|
28
|
-
options[:id_generator] = Cucumber::Messages::IdGenerator::Incrementing.new if
|
27
|
+
opts.on('--predictable-ids', 'Generate incrementing ids rather than UUIDs') do |value|
|
28
|
+
options[:id_generator] = Cucumber::Messages::Helpers::IdGenerator::Incrementing.new if value
|
29
29
|
end
|
30
30
|
end.parse!
|
31
31
|
|
@@ -38,7 +38,7 @@ end
|
|
38
38
|
|
39
39
|
if ARGV.empty?
|
40
40
|
# Read from STDIN
|
41
|
-
messages = Cucumber::Messages::NdjsonToMessageEnumerator.new(STDIN)
|
41
|
+
messages = Cucumber::Messages::Helpers::NdjsonToMessageEnumerator.new(STDIN)
|
42
42
|
else
|
43
43
|
messages = Gherkin.from_paths(ARGV, options)
|
44
44
|
end
|
@@ -278,7 +278,7 @@
|
|
278
278
|
"Nə vaxt ki "
|
279
279
|
]
|
280
280
|
},
|
281
|
-
|
281
|
+
"be": {
|
282
282
|
"and": [
|
283
283
|
"* ",
|
284
284
|
"I ",
|
@@ -1401,14 +1401,14 @@
|
|
1401
1401
|
"ga": {
|
1402
1402
|
"and": [
|
1403
1403
|
"* ",
|
1404
|
-
"Agus"
|
1404
|
+
"Agus "
|
1405
1405
|
],
|
1406
1406
|
"background": [
|
1407
1407
|
"Cúlra"
|
1408
1408
|
],
|
1409
1409
|
"but": [
|
1410
1410
|
"* ",
|
1411
|
-
"Ach"
|
1411
|
+
"Ach "
|
1412
1412
|
],
|
1413
1413
|
"examples": [
|
1414
1414
|
"Samplaí"
|
@@ -1418,10 +1418,10 @@
|
|
1418
1418
|
],
|
1419
1419
|
"given": [
|
1420
1420
|
"* ",
|
1421
|
-
"Cuir i gcás go",
|
1422
|
-
"Cuir i gcás nach",
|
1423
|
-
"Cuir i gcás gur",
|
1424
|
-
"Cuir i gcás nár"
|
1421
|
+
"Cuir i gcás go ",
|
1422
|
+
"Cuir i gcás nach ",
|
1423
|
+
"Cuir i gcás gur ",
|
1424
|
+
"Cuir i gcás nár "
|
1425
1425
|
],
|
1426
1426
|
"name": "Irish",
|
1427
1427
|
"native": "Gaeilge",
|
@@ -1437,14 +1437,14 @@
|
|
1437
1437
|
],
|
1438
1438
|
"then": [
|
1439
1439
|
"* ",
|
1440
|
-
"Ansin"
|
1440
|
+
"Ansin "
|
1441
1441
|
],
|
1442
1442
|
"when": [
|
1443
1443
|
"* ",
|
1444
|
-
"Nuair a",
|
1445
|
-
"Nuair nach",
|
1446
|
-
"Nuair ba",
|
1447
|
-
"Nuair nár"
|
1444
|
+
"Nuair a ",
|
1445
|
+
"Nuair nach ",
|
1446
|
+
"Nuair ba ",
|
1447
|
+
"Nuair nár "
|
1448
1448
|
]
|
1449
1449
|
},
|
1450
1450
|
"gj": {
|
@@ -1474,7 +1474,7 @@
|
|
1474
1474
|
"name": "Gujarati",
|
1475
1475
|
"native": "ગુજરાતી",
|
1476
1476
|
"rule": [
|
1477
|
-
"
|
1477
|
+
"નિયમ"
|
1478
1478
|
],
|
1479
1479
|
"scenario": [
|
1480
1480
|
"ઉદાહરણ",
|
@@ -2133,15 +2133,15 @@
|
|
2133
2133
|
"ko": {
|
2134
2134
|
"and": [
|
2135
2135
|
"* ",
|
2136
|
-
"그리고"
|
2136
|
+
"그리고 "
|
2137
2137
|
],
|
2138
2138
|
"background": [
|
2139
2139
|
"배경"
|
2140
2140
|
],
|
2141
2141
|
"but": [
|
2142
2142
|
"* ",
|
2143
|
-
"하지만",
|
2144
|
-
"단"
|
2143
|
+
"하지만 ",
|
2144
|
+
"단 "
|
2145
2145
|
],
|
2146
2146
|
"examples": [
|
2147
2147
|
"예"
|
@@ -2151,8 +2151,8 @@
|
|
2151
2151
|
],
|
2152
2152
|
"given": [
|
2153
2153
|
"* ",
|
2154
|
-
"조건",
|
2155
|
-
"먼저"
|
2154
|
+
"조건 ",
|
2155
|
+
"먼저 "
|
2156
2156
|
],
|
2157
2157
|
"name": "Korean",
|
2158
2158
|
"native": "한국어",
|
@@ -2167,12 +2167,12 @@
|
|
2167
2167
|
],
|
2168
2168
|
"then": [
|
2169
2169
|
"* ",
|
2170
|
-
"그러면"
|
2170
|
+
"그러면 "
|
2171
2171
|
],
|
2172
2172
|
"when": [
|
2173
2173
|
"* ",
|
2174
|
-
"만일",
|
2175
|
-
"만약"
|
2174
|
+
"만일 ",
|
2175
|
+
"만약 "
|
2176
2176
|
]
|
2177
2177
|
},
|
2178
2178
|
"lt": {
|
@@ -3015,7 +3015,6 @@
|
|
3015
3015
|
"Правило"
|
3016
3016
|
],
|
3017
3017
|
"scenario": [
|
3018
|
-
"Пример",
|
3019
3018
|
"Сценарио",
|
3020
3019
|
"Пример"
|
3021
3020
|
],
|
@@ -3134,7 +3133,7 @@
|
|
3134
3133
|
"ta": {
|
3135
3134
|
"and": [
|
3136
3135
|
"* ",
|
3137
|
-
"மேலும்
|
3136
|
+
"மேலும் ",
|
3138
3137
|
"மற்றும் "
|
3139
3138
|
],
|
3140
3139
|
"background": [
|
@@ -3142,7 +3141,7 @@
|
|
3142
3141
|
],
|
3143
3142
|
"but": [
|
3144
3143
|
"* ",
|
3145
|
-
"ஆனால்
|
3144
|
+
"ஆனால் "
|
3146
3145
|
],
|
3147
3146
|
"examples": [
|
3148
3147
|
"எடுத்துக்காட்டுகள்",
|
data/lib/gherkin/gherkin_line.rb
CHANGED
data/lib/gherkin/parser.rb
CHANGED
@@ -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(Cucumber::Messages::IdGenerator::UUID.new))
|
59
|
+
def initialize(ast_builder = AstBuilder.new(Cucumber::Messages::Helpers::IdGenerator::UUID.new))
|
60
60
|
@ast_builder = ast_builder
|
61
61
|
end
|
62
62
|
|
@@ -11,7 +11,7 @@ module Gherkin
|
|
11
11
|
@sources = sources
|
12
12
|
@options = options
|
13
13
|
|
14
|
-
id_generator = options[:id_generator] || Cucumber::Messages::IdGenerator::UUID.new
|
14
|
+
id_generator = options[:id_generator] || Cucumber::Messages::Helpers::IdGenerator::UUID.new
|
15
15
|
@parser = Parser.new(AstBuilder.new(id_generator))
|
16
16
|
@compiler = Pickles::Compiler.new(id_generator)
|
17
17
|
end
|
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:
|
4
|
+
version: 29.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gáspár Nagy
|
@@ -10,68 +10,70 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-08-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cucumber-messages
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - "
|
19
|
+
- - ">"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '25'
|
22
22
|
- - "<"
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '
|
24
|
+
version: '26'
|
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:
|
31
|
+
version: '25'
|
32
32
|
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '26'
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rake
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '13.
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: 13.0.6
|
41
|
+
version: '13.1'
|
45
42
|
type: :development
|
46
43
|
prerelease: false
|
47
44
|
version_requirements: !ruby/object:Gem::Requirement
|
48
45
|
requirements:
|
49
46
|
- - "~>"
|
50
47
|
- !ruby/object:Gem::Version
|
51
|
-
version: '13.
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 13.0.6
|
48
|
+
version: '13.1'
|
55
49
|
- !ruby/object:Gem::Dependency
|
56
50
|
name: rspec
|
57
51
|
requirement: !ruby/object:Gem::Requirement
|
58
52
|
requirements:
|
59
53
|
- - "~>"
|
60
54
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 3.11.0
|
55
|
+
version: '3.13'
|
65
56
|
type: :development
|
66
57
|
prerelease: false
|
67
58
|
version_requirements: !ruby/object:Gem::Requirement
|
68
59
|
requirements:
|
69
60
|
- - "~>"
|
70
61
|
- !ruby/object:Gem::Version
|
71
|
-
version: '3.
|
72
|
-
|
62
|
+
version: '3.13'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rubocop
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.26.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
73
75
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
76
|
+
version: 1.26.0
|
75
77
|
description: Gherkin parser
|
76
78
|
email: cukes@googlegroups.com
|
77
79
|
executables:
|
@@ -80,6 +82,7 @@ executables:
|
|
80
82
|
extensions: []
|
81
83
|
extra_rdoc_files: []
|
82
84
|
files:
|
85
|
+
- LICENSE
|
83
86
|
- README.md
|
84
87
|
- bin/gherkin
|
85
88
|
- bin/gherkin-ruby
|
@@ -98,13 +101,6 @@ files:
|
|
98
101
|
- lib/gherkin/token_formatter_builder.rb
|
99
102
|
- lib/gherkin/token_matcher.rb
|
100
103
|
- 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
104
|
homepage: https://github.com/cucumber/gherkin
|
109
105
|
licenses:
|
110
106
|
- MIT
|
@@ -123,22 +119,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
119
|
requirements:
|
124
120
|
- - ">="
|
125
121
|
- !ruby/object:Gem::Version
|
126
|
-
version: '
|
122
|
+
version: '3.0'
|
127
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
124
|
requirements:
|
129
125
|
- - ">="
|
130
126
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
127
|
+
version: 3.2.8
|
132
128
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
129
|
+
rubygems_version: 3.5.11
|
134
130
|
signing_key:
|
135
131
|
specification_version: 4
|
136
|
-
summary: cucumber-gherkin-
|
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
|
132
|
+
summary: cucumber-gherkin-29.0.0
|
133
|
+
test_files: []
|
data/spec/capture_warnings.rb
DELETED
@@ -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
|
data/spec/gherkin/parser_spec.rb
DELETED
data/spec/gherkin/query_spec.rb
DELETED
@@ -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
|