cucumber-gherkin 26.2.0 → 28.0.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: af2b5602cd53419921854a98f765dceb9bb7f7eeff21e916f645d714db6fecda
4
- data.tar.gz: 302c22cb981324b42974325f61a0eb3c5ee20dc8eaf2cbd7e90c2f893dc31209
3
+ metadata.gz: ece34082ea75a09a5cbeae3980afa533c15807b6bfdcebff24b757f01dbccc5e
4
+ data.tar.gz: c36a3c7b537533d54653d8ac71e4f7514a20a9898712c04c3c19dc49881fbbe8
5
5
  SHA512:
6
- metadata.gz: 8d07a4dd58a8e9fc773a8361036badbfa7abd550b7bbbd63ccfaf43a8454491236657134371790580de3ef3c2f7acba8d4dfc65c9143e92d44acedd7841e783b
7
- data.tar.gz: b107c64e600c1841b4ea275ee70eaac3426fe6e4c435e8da74883f944d0089a212b0646c40a0f2f26fe367e04a6f8027db8d44e3ca0fa4e719f2e645fe50fa40
6
+ metadata.gz: 6c81377d145f9944910004eeb22b75570ecc850d4c2cccbb9d851e2b9c89bcdbd5e54fafcc531bdb27a7833275ebf3be6504bc6dee23f457a401e8ebcbbf459c
7
+ data.tar.gz: 553a43f5d6e5ce49d0573ba64b4c42b5089519c0e56c66b20dd92fb70e9790db6e3000581d922df5f312389a6860cc1d59adc4ef300224f280680874cd94e099
@@ -630,7 +630,7 @@
630
630
  "name": "Danish",
631
631
  "native": "dansk",
632
632
  "rule": [
633
- "Rule"
633
+ "Regel"
634
634
  ],
635
635
  "scenario": [
636
636
  "Eksempel",
@@ -1132,7 +1132,7 @@
1132
1132
  "name": "Esperanto",
1133
1133
  "native": "Esperanto",
1134
1134
  "rule": [
1135
- "Rule"
1135
+ "Regulo"
1136
1136
  ],
1137
1137
  "scenario": [
1138
1138
  "Ekzemplo",
@@ -1426,7 +1426,7 @@
1426
1426
  "name": "Irish",
1427
1427
  "native": "Gaeilge",
1428
1428
  "rule": [
1429
- "Rule"
1429
+ "Riail"
1430
1430
  ],
1431
1431
  "scenario": [
1432
1432
  "Sampla",
@@ -1886,7 +1886,8 @@
1886
1886
  "it": {
1887
1887
  "and": [
1888
1888
  "* ",
1889
- "E "
1889
+ "E ",
1890
+ "Ed "
1890
1891
  ],
1891
1892
  "background": [
1892
1893
  "Contesto"
@@ -2532,7 +2533,7 @@
2532
2533
  "name": "Dutch",
2533
2534
  "native": "Nederlands",
2534
2535
  "rule": [
2535
- "Rule"
2536
+ "Regel"
2536
2537
  ],
2537
2538
  "scenario": [
2538
2539
  "Voorbeeld",
@@ -3575,7 +3576,7 @@
3575
3576
  "name": "Vietnamese",
3576
3577
  "native": "Tiếng Việt",
3577
3578
  "rule": [
3578
- "Rule"
3579
+ "Quy tắc"
3579
3580
  ],
3580
3581
  "scenario": [
3581
3582
  "Tình huống",
@@ -3643,6 +3644,47 @@
3643
3644
  "当"
3644
3645
  ]
3645
3646
  },
3647
+ "ml": {
3648
+ "and": [
3649
+ "* ",
3650
+ "ഒപ്പം"
3651
+ ],
3652
+ "background": [
3653
+ "പശ്ചാത്തലം"
3654
+ ],
3655
+ "but": [
3656
+ "* ",
3657
+ "പക്ഷേ"
3658
+ ],
3659
+ "examples": [
3660
+ "ഉദാഹരണങ്ങൾ"
3661
+ ],
3662
+ "feature": [
3663
+ "സവിശേഷത"
3664
+ ],
3665
+ "given": [
3666
+ "* ",
3667
+ "നൽകിയത്"
3668
+ ],
3669
+ "name": "Malayalam",
3670
+ "native": "മലയാളം",
3671
+ "rule": [
3672
+ "നിയമം"
3673
+ ],
3674
+ "scenario": [
3675
+ "രംഗം"
3676
+ ],
3677
+ "scenarioOutline": [
3678
+ "സാഹചര്യത്തിന്റെ രൂപരേഖ"
3679
+ ],
3680
+ "then": [
3681
+ "* ",
3682
+ "പിന്നെ"
3683
+ ],
3684
+ "when": [
3685
+ "എപ്പോൾ"
3686
+ ]
3687
+ },
3646
3688
  "zh-TW": {
3647
3689
  "and": [
3648
3690
  "* ",
data/lib/gherkin/query.rb CHANGED
@@ -2,12 +2,19 @@ module Gherkin
2
2
  class Query
3
3
  def initialize
4
4
  @ast_node_locations = {}
5
+ @scenario_parent_locations = {}
6
+ @background_locations = {}
5
7
  end
6
8
 
7
9
  def update(message)
8
10
  update_feature(message.gherkin_document.feature) if message.gherkin_document
9
11
  end
10
12
 
13
+ def scenario_parent_locations(scenario_node_id)
14
+ return @scenario_parent_locations[scenario_node_id] if @scenario_parent_locations.has_key?(scenario_node_id)
15
+ raise AstNodeNotLocatedException, "No scenario parent locations found for #{scenario_node_id} }. Known: #{@scenario_parent_locations.keys}"
16
+ end
17
+
11
18
  def location(ast_node_id)
12
19
  return @ast_node_locations[ast_node_id] if @ast_node_locations.has_key?(ast_node_id)
13
20
  raise AstNodeNotLocatedException, "No location found for #{ast_node_id} }. Known: #{@ast_node_locations.keys}"
@@ -20,27 +27,27 @@ module Gherkin
20
27
  store_nodes_location(feature.tags)
21
28
 
22
29
  feature.children.each do |child|
23
- update_rule(child.rule) if child.rule
24
- update_background(child.background) if child.background
25
- update_scenario(child.scenario) if child.scenario
30
+ update_rule(feature, child.rule) if child.rule
31
+ update_background(feature, child.background) if child.background
32
+ update_scenario(feature, child.rule, child.scenario) if child.scenario
26
33
  end
27
34
  end
28
35
 
29
- def update_rule(rule)
36
+ def update_rule(feature, rule)
30
37
  return if rule.nil?
31
38
  store_nodes_location(rule.tags)
32
-
33
39
  rule.children.each do |child|
34
- update_background(child.background) if child.background
35
- update_scenario(child.scenario) if child.scenario
40
+ update_background(rule, child.background) if child.background
41
+ update_scenario(feature, rule, child.scenario) if child.scenario
36
42
  end
37
43
  end
38
44
 
39
- def update_background(background)
45
+ def update_background(parent, background)
40
46
  update_steps(background.steps)
47
+ @background_locations[parent] = background.location
41
48
  end
42
49
 
43
- def update_scenario(scenario)
50
+ def update_scenario(feature, rule, scenario)
44
51
  store_node_location(scenario)
45
52
  store_nodes_location(scenario.tags)
46
53
  update_steps(scenario.steps)
@@ -48,6 +55,13 @@ module Gherkin
48
55
  store_nodes_location(examples.tags || [])
49
56
  store_nodes_location(examples.table_body || [])
50
57
  end
58
+
59
+ @scenario_parent_locations[scenario.id] = [
60
+ feature.location,
61
+ @background_locations[feature],
62
+ rule&.location,
63
+ @background_locations[rule],
64
+ ].compact
51
65
  end
52
66
 
53
67
  def update_steps(steps)
@@ -47,6 +47,7 @@ describe Gherkin::Query do
47
47
  Examples:
48
48
  | Status |
49
49
  | passed |
50
+ | failed |
50
51
 
51
52
  @rule-tag
52
53
  Rule: this is a rule
@@ -71,6 +72,56 @@ describe Gherkin::Query do
71
72
  end
72
73
  end
73
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
+
74
125
  describe '#location' do
75
126
  before do
76
127
  messages.each { |message| subject.update(message) }
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: 26.2.0
4
+ version: 28.0.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: 2023-04-07 00:00:00.000000000 Z
13
+ date: 2024-02-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber-messages
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 19.1.4
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '22.1'
24
+ version: '24'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,7 +31,7 @@ dependencies:
31
31
  version: 19.1.4
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '22.1'
34
+ version: '24'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rake
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -123,17 +123,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: '2.3'
126
+ version: '2.5'
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  requirements: []
133
- rubygems_version: 3.2.22
133
+ rubygems_version: 3.4.19
134
134
  signing_key:
135
135
  specification_version: 4
136
- summary: cucumber-gherkin-26.2.0
136
+ summary: cucumber-gherkin-28.0.0
137
137
  test_files:
138
138
  - spec/capture_warnings.rb
139
139
  - spec/gherkin/dialect_spec.rb