cucumber-core 17.0.0 → 18.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88faed296b96d11e574838451644e6ab5e784bb2e4bdf9238f24b4488dc4a902
4
- data.tar.gz: 020fe0f4bbc9072752a0748465157991e9c65765ce47c33061c89bedd7e37db0
3
+ metadata.gz: 40198f152a14c95e0b6bc0edd0191ea57223037d6452849926f20691114cfb4f
4
+ data.tar.gz: 81b94a76c6113fbd26be6aba465294d61185d48202ef153196b95465f094f7c3
5
5
  SHA512:
6
- metadata.gz: 9f1900994b1560af95ba5871cd9ee8f9647d1e93e4148e6ed1d56406c4fffaa85afdccebfc9d05a11d795bebf473e2450589656d193e7d42d6412d4c1a861fa4
7
- data.tar.gz: 7490537caa92180e2887080e8bd7fa169bc9994dd2d01262ffb57b3d3b3d5df1a34c7ae6503d5433847409b44586e221bdd2dd00ec7f28a094c00878751e480e
6
+ metadata.gz: e20c7fad6648efad8b47f55c79259c7c35106b0778c714e31f387dbcfae17699a5283841894f5ec94ab8dd7f3792c4fd6958186ebf5a3845404c26318e9d3fa1
7
+ data.tar.gz: 5c2477e304ae210c4c0efde9b2445c576d209cc116fd78e25b95afe7965c6cbba4161ae1e8e2235c3aa3d1bd92668a001f163f5dabd848206758a7a2700484c9
data/CHANGELOG.md CHANGED
@@ -10,6 +10,10 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [18.0.0] - 2026-07-13
14
+ ### Changed
15
+ - Tidied up a bunch of mostly internal test code to be more rubocop compliant
16
+
13
17
  ## [17.0.0] - 2026-06-01
14
18
  ### Added
15
19
  - Added `#to_envelope` for `Cucumber::Core::Gherkin::Document` ([#329](https://github.com/cucumber/cucumber-ruby-core/pull/329))
@@ -88,12 +92,9 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
88
92
  ## [14.0.0] - 2024-08-08
89
93
  ### Changed
90
94
  - Permit usage of gherkin up to v29 and messages up to v26
91
- - **Internal Breaking Change**: Structure of `Action` classes have changed.
92
- See upgrading notes for [14.0.0.md](upgrading_notes/14.0.0.md#upgrading-to-cucumber-core-1400)
93
- ([#282](https://github.com/cucumber/cucumber-ruby-core/pull/282))
94
95
 
95
96
  ### Removed
96
- - Remove support for ruby 2.6 and below. 2.7 or higher is required now (Autofixed to Ruby 2.7 styles)
97
+ - Removed support for ruby 2.6 and below. 2.7 or higher is required now (Autofixed to Ruby 2.7 styles)
97
98
 
98
99
  ## [13.0.3] - 2024-07-24
99
100
  ### Changed
@@ -149,7 +150,8 @@ See upgrading notes for [13.0.0.md](upgrading_notes/13.0.0.md#upgrading-to-cucum
149
150
  ### Changed
150
151
  - Updated `cucumber-gherkin` and `cucumber-messages`
151
152
 
152
- [Unreleased]: https://github.com/cucumber/cucumber-ruby-core/compare/v17.0.0...HEAD
153
+ [Unreleased]: https://github.com/cucumber/cucumber-ruby-core/compare/v18.0.0...HEAD
154
+ [18.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v17.0.0...v18.0.0
153
155
  [17.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v16.2.0...v17.0.0
154
156
  [16.2.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v16.1.1...v16.2.0
155
157
  [16.1.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v16.1.0...v16.1.1
@@ -169,3 +171,10 @@ See upgrading notes for [13.0.0.md](upgrading_notes/13.0.0.md#upgrading-to-cucum
169
171
  [12.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v11.1.0...v12.0.0
170
172
  [11.1.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v11.0.0...v11.1.0
171
173
  [11.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v10.1.1...v11.0.0
174
+ .3]: https://github.com/cucumber/cucumber-ruby-core/compare/v13.0.2...v13.0.3
175
+ [13.0.2]: https://github.com/cucumber/cucumber-ruby-core/compare/v13.0.1...v13.0.2
176
+ [13.0.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v13.0.0...v13.0.1
177
+ [13.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v12.0.0...v13.0.0
178
+ [12.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v11.1.0...v12.0.0
179
+ [11.1.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v11.0.0...v11.1.0
180
+ [11.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v10.1.1...v11.0.0
@@ -5,7 +5,7 @@ require 'gherkin'
5
5
  module Cucumber
6
6
  module Core
7
7
  module Gherkin
8
- ParseError = Class.new(StandardError)
8
+ class ParseError < StandardError; end
9
9
 
10
10
  class Parser
11
11
  attr_reader :receiver, :event_bus, :gherkin_query
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Core
5
+ module Gherkin
6
+ module Writer
7
+ module AcceptsComments
8
+ def comment(line)
9
+ comment_lines << "# #{line}"
10
+ end
11
+
12
+ def comment_lines
13
+ @comment_lines ||= []
14
+ end
15
+
16
+ def slurp_comments
17
+ comment_lines.tap { @comment_lines = nil }
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -10,7 +10,9 @@ module Cucumber
10
10
  include HasElements
11
11
  include HasOptionsInitializer
12
12
  include HasDescription
13
- include Indentation.level 2
13
+ extend Indentation
14
+
15
+ indentation_level 2
14
16
 
15
17
  default_keyword 'Background'
16
18
 
@@ -7,7 +7,9 @@ module Cucumber
7
7
  module Gherkin
8
8
  module Writer
9
9
  class DocString
10
- include Indentation.level(6)
10
+ extend Indentation
11
+
12
+ indentation_level 6
11
13
 
12
14
  attr_reader :strings, :content_type
13
15
  private :strings, :content_type
@@ -8,7 +8,9 @@ module Cucumber
8
8
  module Gherkin
9
9
  module Writer
10
10
  class Example < Scenario
11
- include Indentation.level 4
11
+ extend Indentation
12
+
13
+ indentation_level 4
12
14
 
13
15
  default_keyword 'Example'
14
16
  end
@@ -12,7 +12,9 @@ module Cucumber
12
12
  include HasOptionsInitializer
13
13
  include HasRows
14
14
  include HasDescription
15
- include Indentation.level(4)
15
+ extend Indentation
16
+
17
+ indentation_level 4
16
18
 
17
19
  default_keyword 'Examples'
18
20
 
@@ -12,7 +12,9 @@ module Cucumber
12
12
  include HasElements
13
13
  include HasOptionsInitializer
14
14
  include HasDescription
15
- include Indentation.level(0)
15
+ extend Indentation
16
+
17
+ indentation_level 0
16
18
 
17
19
  default_keyword 'Feature'
18
20
 
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Core
5
+ module Gherkin
6
+ module Writer
7
+ module HasDescription
8
+ private
9
+
10
+ def description
11
+ options.fetch(:description, '').split("\n").map(&:strip)
12
+ end
13
+
14
+ def description_statement
15
+ description.map { |s| indent(s, 2) } unless description.empty?
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Core
5
+ module Gherkin
6
+ module Writer
7
+ module HasElements
8
+ include AcceptsComments
9
+
10
+ def self.included(base)
11
+ base.extend HasElementBuilders
12
+ end
13
+
14
+ def build(source = [])
15
+ elements.inject(source + statements) { |acc, el| el.build(acc) }
16
+ end
17
+
18
+ private
19
+
20
+ def elements
21
+ @elements ||= []
22
+ end
23
+
24
+ module HasElementBuilders
25
+ def elements(*names)
26
+ names.each { |name| element(name) }
27
+ end
28
+
29
+ private
30
+
31
+ def element(name)
32
+ define_method(name) do |*args, &source|
33
+ factory_name = String(name).split('_').map(&:capitalize).join
34
+ factory = Writer.const_get(factory_name)
35
+ factory.new(slurp_comments, *args).tap do |builder|
36
+ builder.instance_exec(&source) if source
37
+ elements << builder
38
+ end
39
+ self
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Core
5
+ module Gherkin
6
+ module Writer
7
+ module HasOptionsInitializer
8
+ def self.included(base)
9
+ base.extend HasDefaultKeyword
10
+ end
11
+
12
+ attr_reader :name, :options
13
+ private :name, :options
14
+
15
+ def initialize(*args)
16
+ @comments = args.shift if args.first.is_a?(Array)
17
+ @comments ||= []
18
+ @options = args.pop if args.last.is_a?(Hash)
19
+ @options ||= {}
20
+ @name = args.first
21
+ end
22
+
23
+ private
24
+
25
+ def comments_statement
26
+ @comments
27
+ end
28
+
29
+ def keyword
30
+ options.fetch(:keyword) { self.class.keyword }
31
+ end
32
+
33
+ def name_statement
34
+ "#{keyword}: #{name}".strip
35
+ end
36
+
37
+ def tag_statement
38
+ tags
39
+ end
40
+
41
+ def tags
42
+ options[:tags]
43
+ end
44
+
45
+ module HasDefaultKeyword
46
+ def default_keyword(keyword)
47
+ @keyword = keyword
48
+ end
49
+
50
+ def keyword
51
+ @keyword
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Core
5
+ module Gherkin
6
+ module Writer
7
+ module HasRows
8
+ def row(*cells)
9
+ rows << cells
10
+ end
11
+
12
+ def rows
13
+ @rows ||= []
14
+ end
15
+
16
+ private
17
+
18
+ def row_statements(indent = nil)
19
+ rows.map { |row| indent(table_row(row), indent) }
20
+ end
21
+
22
+ def table_row(row)
23
+ padded = pad(row)
24
+ "| #{padded.join(' | ')} |"
25
+ end
26
+
27
+ def pad(row)
28
+ row.map.with_index { |text, position| justify_cell(text, position) }
29
+ end
30
+
31
+ def column_length(column)
32
+ lengths = rows.transpose.map { |r| r.map(&:length).max }
33
+ lengths[column]
34
+ end
35
+
36
+ def justify_cell(cell, position)
37
+ cell.ljust(column_length(position))
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,177 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Cucumber
4
- module Core
5
- module Gherkin
6
- module Writer
7
- module HasOptionsInitializer
8
- def self.included(base)
9
- base.extend HasDefaultKeyword
10
- end
3
+ require_relative 'accepts_comments'
11
4
 
12
- attr_reader :name, :options
13
- private :name, :options
14
-
15
- def initialize(*args)
16
- @comments = args.shift if args.first.is_a?(Array)
17
- @comments ||= []
18
- @options = args.pop if args.last.is_a?(Hash)
19
- @options ||= {}
20
- @name = args.first
21
- end
22
-
23
- private
24
-
25
- def comments_statement
26
- @comments
27
- end
28
-
29
- def keyword
30
- options.fetch(:keyword) { self.class.keyword }
31
- end
32
-
33
- def name_statement
34
- "#{keyword}: #{name}".strip
35
- end
36
-
37
- def tag_statement
38
- tags
39
- end
40
-
41
- def tags
42
- options[:tags]
43
- end
44
-
45
- module HasDefaultKeyword
46
- def default_keyword(keyword)
47
- @keyword = keyword
48
- end
49
-
50
- def keyword
51
- @keyword
52
- end
53
- end
54
- end
55
-
56
- module AcceptsComments
57
- def comment(line)
58
- comment_lines << "# #{line}"
59
- end
60
-
61
- def comment_lines
62
- @comment_lines ||= []
63
- end
64
-
65
- def slurp_comments
66
- comment_lines.tap { @comment_lines = nil }
67
- end
68
- end
69
-
70
- module HasElements
71
- include AcceptsComments
72
-
73
- def self.included(base)
74
- base.extend HasElementBuilders
75
- end
76
-
77
- def build(source = [])
78
- elements.inject(source + statements) { |acc, el| el.build(acc) }
79
- end
80
-
81
- private
82
-
83
- def elements
84
- @elements ||= []
85
- end
86
-
87
- module HasElementBuilders
88
- def elements(*names)
89
- names.each { |name| element(name) }
90
- end
91
-
92
- private
93
-
94
- def element(name)
95
- define_method(name) do |*args, &source|
96
- factory_name = String(name).split('_').map(&:capitalize).join
97
- factory = Writer.const_get(factory_name)
98
- factory.new(slurp_comments, *args).tap do |builder|
99
- builder.instance_exec(&source) if source
100
- elements << builder
101
- end
102
- self
103
- end
104
- end
105
- end
106
- end
107
-
108
- module Indentation
109
- def self.level(number)
110
- Module.new do
111
- define_method(:indent) do |string, amount = nil|
112
- return string if string.nil? || string.empty?
113
-
114
- amount ||= number
115
- "#{' ' * amount}#{string}"
116
- end
117
-
118
- define_method(:indent_level) do
119
- number
120
- end
121
-
122
- define_method(:prepare_statements) do |*statements|
123
- statements.flatten.compact.map { |s| indent(s) }
124
- end
125
- end
126
- end
127
- end
128
-
129
- module HasDescription
130
- private
131
-
132
- def description
133
- options.fetch(:description, '').split("\n").map(&:strip)
134
- end
135
-
136
- def description_statement
137
- description.map { |s| indent(s, 2) } unless description.empty?
138
- end
139
- end
140
-
141
- module HasRows
142
- def row(*cells)
143
- rows << cells
144
- end
145
-
146
- def rows
147
- @rows ||= []
148
- end
149
-
150
- private
151
-
152
- def row_statements(indent = nil)
153
- rows.map { |row| indent(table_row(row), indent) }
154
- end
155
-
156
- def table_row(row)
157
- padded = pad(row)
158
- "| #{padded.join(' | ')} |"
159
- end
160
-
161
- def pad(row)
162
- row.map.with_index { |text, position| justify_cell(text, position) }
163
- end
164
-
165
- def column_length(column)
166
- lengths = rows.transpose.map { |r| r.map(&:length).max }
167
- lengths[column]
168
- end
169
-
170
- def justify_cell(cell, position)
171
- cell.ljust(column_length(position))
172
- end
173
- end
174
- end
175
- end
176
- end
177
- end
5
+ require_relative 'has_description'
6
+ require_relative 'has_elements'
7
+ require_relative 'has_options_initializer'
8
+ require_relative 'has_rows'
9
+ require_relative 'indentation'
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Core
5
+ module Gherkin
6
+ module Writer
7
+ module Indentation
8
+ def indentation_level(number)
9
+ create_indent(number)
10
+ create_indent_level(number)
11
+ create_prepare_statements
12
+ end
13
+
14
+ private
15
+
16
+ def create_indent(number)
17
+ define_method(:indent) do |string, amount = nil|
18
+ return string if string.nil? || string.empty?
19
+
20
+ amount ||= number
21
+ "#{' ' * amount}#{string}"
22
+ end
23
+ end
24
+
25
+ def create_indent_level(number)
26
+ define_method(:indent_level) do
27
+ number
28
+ end
29
+ end
30
+
31
+ def create_prepare_statements
32
+ define_method(:prepare_statements) do |*statements|
33
+ statements.flatten.compact.map { |s| indent(s) }
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -12,7 +12,9 @@ module Cucumber
12
12
  include HasElements
13
13
  include HasOptionsInitializer
14
14
  include HasDescription
15
- include Indentation.level 2
15
+ extend Indentation
16
+
17
+ indentation_level 2
16
18
 
17
19
  default_keyword 'Rule'
18
20
 
@@ -10,7 +10,9 @@ module Cucumber
10
10
  include HasElements
11
11
  include HasOptionsInitializer
12
12
  include HasDescription
13
- include Indentation.level 2
13
+ extend Indentation
14
+
15
+ indentation_level 2
14
16
 
15
17
  default_keyword 'Scenario'
16
18
 
@@ -10,7 +10,9 @@ module Cucumber
10
10
  include HasElements
11
11
  include HasOptionsInitializer
12
12
  include HasDescription
13
- include Indentation.level 2
13
+ extend Indentation
14
+
15
+ indentation_level 2
14
16
 
15
17
  default_keyword 'Scenario Outline'
16
18
 
@@ -11,7 +11,9 @@ module Cucumber
11
11
  class Step
12
12
  include HasElements
13
13
  include HasOptionsInitializer
14
- include Indentation.level 4
14
+ extend Indentation
15
+
16
+ indentation_level 4
15
17
 
16
18
  default_keyword 'Given'
17
19
 
@@ -7,7 +7,10 @@ module Cucumber
7
7
  module Gherkin
8
8
  module Writer
9
9
  class Table
10
- include Indentation.level(6)
10
+ extend Indentation
11
+
12
+ indentation_level 6
13
+
11
14
  include HasRows
12
15
 
13
16
  def initialize(*); end
@@ -57,7 +57,7 @@ module Cucumber
57
57
  end
58
58
 
59
59
  def inspect
60
- %{#<#{self.class} #{raw.inspect}>}
60
+ %(#<#{self.class} #{raw.inspect}>)
61
61
  end
62
62
 
63
63
  def lines_count
@@ -5,7 +5,7 @@ require 'set'
5
5
  module Cucumber
6
6
  module Core
7
7
  module Test
8
- IncompatibleLocations = Class.new(StandardError)
8
+ class IncompatibleLocations < StandardError; end
9
9
 
10
10
  module Location
11
11
  def self.of_caller(additional_depth = 0)
@@ -12,7 +12,7 @@ module Cucumber
12
12
  # retry, therefore only the class method self.ok? is needed.
13
13
  class Flaky
14
14
  def self.ok?
15
- false
15
+ true
16
16
  end
17
17
  end
18
18
  end
@@ -38,7 +38,7 @@ module Cucumber
38
38
  end
39
39
  elsif (defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby') == 'jruby'
40
40
  def time_in_nanoseconds
41
- java.lang.System.nanoTime()
41
+ java.lang.System.nanoTime
42
42
  end
43
43
  else
44
44
  def time_in_nanoseconds
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 17.0.0
4
+ version: 18.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy
@@ -184,13 +184,19 @@ files:
184
184
  - lib/cucumber/core/gherkin/document.rb
185
185
  - lib/cucumber/core/gherkin/parser.rb
186
186
  - lib/cucumber/core/gherkin/writer.rb
187
+ - lib/cucumber/core/gherkin/writer/accepts_comments.rb
187
188
  - lib/cucumber/core/gherkin/writer/background.rb
188
189
  - lib/cucumber/core/gherkin/writer/doc_string.rb
189
190
  - lib/cucumber/core/gherkin/writer/example.rb
190
191
  - lib/cucumber/core/gherkin/writer/examples.rb
191
192
  - lib/cucumber/core/gherkin/writer/feature.rb
192
193
  - lib/cucumber/core/gherkin/writer/gherkin.rb
194
+ - lib/cucumber/core/gherkin/writer/has_description.rb
195
+ - lib/cucumber/core/gherkin/writer/has_elements.rb
196
+ - lib/cucumber/core/gherkin/writer/has_options_initializer.rb
197
+ - lib/cucumber/core/gherkin/writer/has_rows.rb
193
198
  - lib/cucumber/core/gherkin/writer/helpers.rb
199
+ - lib/cucumber/core/gherkin/writer/indentation.rb
194
200
  - lib/cucumber/core/gherkin/writer/rule.rb
195
201
  - lib/cucumber/core/gherkin/writer/scenario.rb
196
202
  - lib/cucumber/core/gherkin/writer/scenario_outline.rb
@@ -257,5 +263,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
263
  requirements: []
258
264
  rubygems_version: 4.0.10
259
265
  specification_version: 4
260
- summary: cucumber-core-17.0.0
266
+ summary: cucumber-core-18.0.0
261
267
  test_files: []