cucumber-core 13.0.3 → 14.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: b2b88e7441c1f14355f2126f50c6373dfd45cd21298d37533297efc44e62cfff
4
- data.tar.gz: bf8cb6fbb013a074b6e65c846cfc76d42f259654639f999b7bd1a91f9bca02ef
3
+ metadata.gz: 570471feb1c7ceb0d00c12ffda878f8520993ec3a8cf31059f38f4eb4e045923
4
+ data.tar.gz: 5e303f42a9aecf8290351f657f9aa763d0a046623e6479083c466cd040cfa8c6
5
5
  SHA512:
6
- metadata.gz: 315e5ac87eb4c89f510ab9626aa3b6e2413ee459ba428ebd0d4be867e171d9600ef25aa9c941e9b34aca98f2375b292365d2d30f72e4a7225ff388180aa7a01a
7
- data.tar.gz: d35ddfa0b15ffae9b824d3826b775f90eb9603f62c88b014ed2edc950226b4afd5fd4a05558922e5e43613dc7d3f686b5607e8d33ef11d20e083b75ba4185974
6
+ metadata.gz: def6d99174f68b29d3daa43256175014306168b77f484341d5fb78b3e2446cf539dff514a9fb85eabb65ec9c342507855121bfa87135b848ea16d29ddcc19a4f
7
+ data.tar.gz: 8873beb624b2cbc3144e8b46cb3d03709855491cfbeba79b796e5f15bdc6540eaa1ec3c59cc67dd43be4b20815ac4ecfc55885ea1cb8034212f924f06197110c
data/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [14.0.0] - 2024-08-08
14
+ ### Changed
15
+ - Permit usage of gherkin up to v29 and messages up to v26
16
+ - **Internal Breaking Change**: Structure of `Action` classes have changed.
17
+ See upgrading notes for [14.0.0.md](upgrading_notes/14.0.0.md#upgrading-to-cucumber-core-1400)
18
+ ([#282](https://github.com/cucumber/cucumber-ruby-core/pull/282))
19
+
20
+ ### Removed
21
+ - Remove support for ruby 2.6 and below. 2.7 or higher is required now (Autofixed to Ruby 2.7 styles)
22
+
13
23
  ## [13.0.3] - 2024-07-24
14
24
  ### Changed
15
25
  - Fixed up all remaining Layout auto-correct cops in the codebase
@@ -31,8 +41,8 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
31
41
  - Now using a 2-tiered changelog to avoid any bugs when using polyglot-release
32
42
  - More refactoring of the repo by fixing up a bunch of manual rubocop offenses (See PR's for details)
33
43
  ([#259](https://github.com/cucumber/cucumber-ruby-core/pull/259) [#262](https://github.com/cucumber/cucumber-ruby-core/pull/262) [#268](https://github.com/cucumber/cucumber-ruby-core/pull/268) [#274](https://github.com/cucumber/cucumber-ruby-core/pull/274))
34
- - In all `Summary` and `Result` classes, changed the `strict` argument into a keyword argument
35
- See upgrading notes for [13.0.0.md](upgrading_notes/13.0.0.md#upgrading-to-1300)
44
+ - In all `Summary` and `Result` classes, changed the `strict` argument into a keyword argument.
45
+ See upgrading notes for [13.0.0.md](upgrading_notes/13.0.0.md#upgrading-to-cucumber-core-1300)
36
46
  ([#261](https://github.com/cucumber/cucumber-ruby-core/pull/261))
37
47
  - Permit usage of gherkin v27
38
48
 
@@ -64,7 +74,8 @@ See upgrading notes for [13.0.0.md](upgrading_notes/13.0.0.md#upgrading-to-1300)
64
74
  ### Changed
65
75
  - Updated `cucumber-gherkin` and `cucumber-messages`
66
76
 
67
- [Unreleased]: https://github.com/cucumber/cucumber-ruby-core/compare/v13.0.3...HEAD
77
+ [Unreleased]: https://github.com/cucumber/cucumber-ruby-core/compare/v14.0.0...HEAD
78
+ [14.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v13.0.3...v14.0.0
68
79
  [13.0.3]: https://github.com/cucumber/cucumber-ruby-core/compare/v13.0.2...v13.0.3
69
80
  [13.0.2]: https://github.com/cucumber/cucumber-ruby-core/compare/v13.0.1...v13.0.2
70
81
  [13.0.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v13.0.0...v13.0.1
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) The Cucumber Organisation
1
+ Copyright (c) Cucumber Ltd. and Contributors
2
2
 
3
3
  MIT License (Expat)
4
4
 
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'cucumber/core/event'
@@ -87,7 +86,7 @@ module Cucumber
87
86
  #
88
87
  # @return [Hash{Symbol => Class}]
89
88
  def self.build_registry(*types)
90
- types.map { |type| [type.event_id, type] }.to_h
89
+ types.to_h { |type| [type.event_id, type] }
91
90
  end
92
91
  end
93
92
  end
@@ -50,7 +50,7 @@ module Cucumber
50
50
  case type?(message)
51
51
  when :gherkin_document; then event_bus.gherkin_source_parsed(message.gherkin_document)
52
52
  when :pickle; then receiver.pickle(message.pickle)
53
- when :parse_error; then raise ParseError.new("#{document.uri}: #{message.parse_error.message}")
53
+ when :parse_error; then raise ParseError, "#{document.uri}: #{message.parse_error.message}"
54
54
  else raise "Unknown message: #{message.to_hash}"
55
55
  end
56
56
  end
@@ -16,7 +16,8 @@ module Cucumber
16
16
 
17
17
  class Gherkin
18
18
  def initialize(uri, &source)
19
- @uri, @source = uri, source
19
+ @uri = uri
20
+ @source = source
20
21
  end
21
22
 
22
23
  def comment(line)
@@ -193,8 +194,7 @@ module Cucumber
193
194
  include Indentation.level(6)
194
195
  include HasRows
195
196
 
196
- def initialize(*)
197
- end
197
+ def initialize(*); end
198
198
 
199
199
  def build(source)
200
200
  source + statements
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/core/test/location'
4
+ require 'cucumber/core/test/result'
5
+ require 'cucumber/core/test/timer'
6
+
7
+ module Cucumber
8
+ module Core
9
+ module Test
10
+ module Action
11
+ class Defined
12
+ attr_reader :location
13
+
14
+ def initialize(location = nil, &block)
15
+ raise ArgumentError, 'Passing a block to execute the action is mandatory.' unless block
16
+
17
+ @location = location || Test::Location.new(*block.source_location)
18
+ @block = block
19
+ @timer = Timer.new
20
+ end
21
+
22
+ def skip(*)
23
+ skipped
24
+ end
25
+
26
+ def execute(*args)
27
+ @timer.start
28
+ @block.call(*args)
29
+ passed
30
+ rescue Result::Raisable => e
31
+ e.with_duration(@timer.duration)
32
+ rescue Exception => e
33
+ failed(e)
34
+ end
35
+
36
+ def inspect
37
+ "#<#{self.class}: #{location}>"
38
+ end
39
+
40
+ private
41
+
42
+ def passed
43
+ Result::Passed.new(@timer.duration)
44
+ end
45
+
46
+ def failed(exception)
47
+ Result::Failed.new(@timer.duration, exception)
48
+ end
49
+
50
+ def skipped
51
+ Result::Skipped.new
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/core/test/result'
4
+
5
+ module Cucumber
6
+ module Core
7
+ module Test
8
+ module Action
9
+ class Undefined
10
+ attr_reader :location
11
+
12
+ def initialize(source_location)
13
+ @location = source_location
14
+ end
15
+
16
+ def execute(*)
17
+ undefined
18
+ end
19
+
20
+ def skip(*)
21
+ undefined
22
+ end
23
+
24
+ private
25
+
26
+ def undefined
27
+ Result::Undefined.new
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/core/test/result'
4
+ require 'cucumber/core/test/action/defined'
5
+
6
+ module Cucumber
7
+ module Core
8
+ module Test
9
+ module Action
10
+ class Unskippable < Defined
11
+ def skip(*args)
12
+ execute(*args)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cucumber/core/test/location'
4
+ require 'cucumber/core/test/result'
5
+ require 'cucumber/core/test/timer'
6
+
7
+ require 'cucumber/core/test/action/defined'
8
+ require 'cucumber/core/test/action/undefined'
9
+ require 'cucumber/core/test/action/unskippable'
@@ -21,10 +21,10 @@ module Cucumber
21
21
  @timer.start
22
22
  @block.call(continue)
23
23
  Result::Unknown.new # Around hook does not know the result of the inner test steps
24
- rescue Result::Raisable => exception
25
- exception.with_duration(@timer.duration)
26
- rescue Exception => exception
27
- failed(exception)
24
+ rescue Result::Raisable => e
25
+ e.with_duration(@timer.duration)
26
+ rescue Exception => e
27
+ failed(e)
28
28
  end
29
29
 
30
30
  private
@@ -10,7 +10,7 @@ module Cucumber
10
10
  attr_reader :id, :name, :test_steps, :location, :parent_locations, :tags, :language, :around_hooks
11
11
 
12
12
  def initialize(id, name, test_steps, location, parent_locations, tags, language, around_hooks = [])
13
- raise ArgumentError.new("test_steps should be an Array but is a #{test_steps.class}") unless test_steps.is_a?(Array)
13
+ raise ArgumentError, "test_steps should be an Array but is a #{test_steps.class}" unless test_steps.is_a?(Array)
14
14
 
15
15
  @id = id
16
16
  @name = name
@@ -101,7 +101,7 @@ module Cucumber
101
101
  end
102
102
 
103
103
  def ensure_array_of_array(array)
104
- Hash === array[0] ? hashes_to_array(array) : array
104
+ array[0].is_a?(Hash) ? hashes_to_array(array) : array
105
105
  end
106
106
 
107
107
  def hashes_to_array(hashes)
@@ -60,9 +60,7 @@ module Cucumber
60
60
  if other.respond_to?(:content_type)
61
61
  return false unless content_type == other.content_type
62
62
  end
63
- if other.respond_to?(:to_str)
64
- return content == other.to_str
65
- end
63
+ return content == other.to_str if other.respond_to?(:to_str)
66
64
 
67
65
  false
68
66
  end
@@ -23,11 +23,11 @@ module Cucumber
23
23
  private
24
24
 
25
25
  def sorted_test_cases
26
- filter_locations.map { |filter_location|
27
- test_cases[filter_location.file].select { |test_case|
26
+ filter_locations.map do |filter_location|
27
+ test_cases[filter_location.file].select do |test_case|
28
28
  test_case.match_locations?([filter_location])
29
- }
30
- }.flatten.uniq
29
+ end
30
+ end.flatten.uniq
31
31
  end
32
32
 
33
33
  def test_cases
@@ -7,9 +7,7 @@ module Cucumber
7
7
  module Test
8
8
  class NameFilter < Filter.new(:name_regexps)
9
9
  def test_case(test_case)
10
- if accept?(test_case)
11
- test_case.describe_to(receiver)
12
- end
10
+ test_case.describe_to(receiver) if accept?(test_case)
13
11
  self
14
12
  end
15
13
 
@@ -8,9 +8,7 @@ module Cucumber
8
8
  class TagFilter < Filter.new(:filter_expressions)
9
9
  def test_case(test_case)
10
10
  test_cases << test_case
11
- if test_case.match_tags?(filter_expressions)
12
- test_case.describe_to(receiver)
13
- end
11
+ test_case.describe_to(receiver) if test_case.match_tags?(filter_expressions)
14
12
  self
15
13
  end
16
14
 
@@ -22,7 +22,7 @@ module Cucumber
22
22
  pwd = File.expand_path(Dir.pwd)
23
23
  pwd.force_encoding(file.encoding)
24
24
  if file.index(pwd)
25
- file = file[pwd.length + 1..-1]
25
+ file = file[pwd.length + 1..]
26
26
  elsif file =~ /.*\/gems\/(.*\.rb)$/
27
27
  file = $1
28
28
  end
@@ -38,7 +38,7 @@ module Cucumber
38
38
  end
39
39
  end
40
40
 
41
- class Wildcard < Struct.new(:file)
41
+ Wildcard = Struct.new(:file) do
42
42
  def to_s
43
43
  file
44
44
  end
@@ -52,7 +52,7 @@ module Cucumber
52
52
  end
53
53
  end
54
54
 
55
- class Precise < Struct.new(:file, :lines)
55
+ Precise = Struct.new(:file, :lines) do
56
56
  def include?(other_lines)
57
57
  lines.include?(other_lines)
58
58
  end
@@ -96,7 +96,7 @@ module Cucumber
96
96
  end
97
97
 
98
98
  require 'set'
99
- class Lines < Struct.new(:data)
99
+ Lines = Struct.new(:data) do
100
100
  protected :data
101
101
 
102
102
  def initialize(raw_data)
@@ -167,17 +167,17 @@ module Cucumber
167
167
  end
168
168
 
169
169
  def tags
170
- # will be overriden by nodes that actually have tags
170
+ # will be overridden by nodes that actually have tags
171
171
  []
172
172
  end
173
173
 
174
174
  def comments
175
- # will be overriden by nodes that actually have comments
175
+ # will be overridden by nodes that actually have comments
176
176
  []
177
177
  end
178
178
 
179
179
  def multiline_arg
180
- # will be overriden by nodes that actually have a multiline_argument
180
+ # will be overridden by nodes that actually have a multiline_argument
181
181
  Test::EmptyMultilineArgument.new
182
182
  end
183
183
  end
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  require 'cucumber/messages'
@@ -173,7 +172,8 @@ module Cucumber
173
172
  attr_reader :message, :duration
174
173
 
175
174
  def initialize(message = '', duration = UnknownDuration.new, backtrace = nil)
176
- @message, @duration = message, duration
175
+ @message = message
176
+ @duration = duration
177
177
  super(message)
178
178
  set_backtrace(backtrace) if backtrace
179
179
  end
@@ -287,7 +287,7 @@ module Cucumber
287
287
  private :settings
288
288
 
289
289
  def initialize(strict_types = [])
290
- @settings = STRICT_AFFECTED_TYPES.map { |t| [t, :default] }.to_h
290
+ @settings = STRICT_AFFECTED_TYPES.to_h { |t| [t, :default] }
291
291
  strict_types.each do |type|
292
292
  set_strict(true, type)
293
293
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'cucumber/core/test/result'
4
- require 'cucumber/core/test/actions'
4
+ require 'cucumber/core/test/action'
5
5
  require 'cucumber/core/test/empty_multiline_argument'
6
6
 
7
7
  module Cucumber
@@ -10,7 +10,7 @@ module Cucumber
10
10
  class Step
11
11
  attr_reader :id, :text, :location, :multiline_arg
12
12
 
13
- def initialize(id, text, location, multiline_arg = Test::EmptyMultilineArgument.new, action = Test::UndefinedAction.new(location))
13
+ def initialize(id, text, location, multiline_arg = Test::EmptyMultilineArgument.new, action = Test::Action::Undefined.new(location))
14
14
  raise ArgumentError if text.nil? || text.empty?
15
15
 
16
16
  @id = id
@@ -37,7 +37,7 @@ module Cucumber
37
37
  end
38
38
 
39
39
  def with_action(action_location = nil, &block)
40
- self.class.new(id, text, location, multiline_arg, Test::Action.new(action_location, &block))
40
+ self.class.new(id, text, location, multiline_arg, Test::Action::Defined.new(action_location, &block))
41
41
  end
42
42
 
43
43
  def backtrace_line
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: 13.0.3
4
+ version: 14.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy
@@ -12,48 +12,48 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2024-07-24 00:00:00.000000000 Z
15
+ date: 2024-08-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: cucumber-gherkin
19
19
  requirement: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
21
+ - - ">"
22
22
  - !ruby/object:Gem::Version
23
23
  version: '27'
24
24
  - - "<"
25
25
  - !ruby/object:Gem::Version
26
- version: '28'
26
+ version: '30'
27
27
  type: :runtime
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ">"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '27'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '28'
36
+ version: '30'
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: cucumber-messages
39
39
  requirement: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - ">="
41
+ - - ">"
42
42
  - !ruby/object:Gem::Version
43
- version: '20'
43
+ version: '22'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '23'
46
+ version: '27'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - ">"
52
52
  - !ruby/object:Gem::Version
53
- version: '20'
53
+ version: '22'
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '23'
56
+ version: '27'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: cucumber-tag-expressions
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -80,14 +80,14 @@ dependencies:
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '13.1'
83
+ version: '13.2'
84
84
  type: :development
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '13.1'
90
+ version: '13.2'
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rspec
93
93
  requirement: !ruby/object:Gem::Requirement
@@ -108,28 +108,28 @@ dependencies:
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: 1.28.2
111
+ version: 1.61.0
112
112
  type: :development
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 1.28.2
118
+ version: 1.61.0
119
119
  - !ruby/object:Gem::Dependency
120
120
  name: rubocop-packaging
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 0.5.1
125
+ version: 0.5.2
126
126
  type: :development
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: 0.5.1
132
+ version: 0.5.2
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: rubocop-rake
135
135
  requirement: !ruby/object:Gem::Requirement
@@ -150,14 +150,14 @@ dependencies:
150
150
  requirements:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: 2.10.0
153
+ version: 3.0.1
154
154
  type: :development
155
155
  prerelease: false
156
156
  version_requirements: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: 2.10.0
160
+ version: 3.0.1
161
161
  description: Core library for the Cucumber BDD app
162
162
  email: cukes@googlegroups.com
163
163
  executables: []
@@ -179,17 +179,16 @@ files:
179
179
  - lib/cucumber/core/gherkin/writer/helpers.rb
180
180
  - lib/cucumber/core/platform.rb
181
181
  - lib/cucumber/core/report/summary.rb
182
- - lib/cucumber/core/test/actions.rb
183
- - lib/cucumber/core/test/actions/action.rb
184
- - lib/cucumber/core/test/actions/undefined_action.rb
185
- - lib/cucumber/core/test/actions/unskippable_action.rb
182
+ - lib/cucumber/core/test/action.rb
183
+ - lib/cucumber/core/test/action/defined.rb
184
+ - lib/cucumber/core/test/action/undefined.rb
185
+ - lib/cucumber/core/test/action/unskippable.rb
186
186
  - lib/cucumber/core/test/around_hook.rb
187
187
  - lib/cucumber/core/test/case.rb
188
188
  - lib/cucumber/core/test/data_table.rb
189
189
  - lib/cucumber/core/test/doc_string.rb
190
190
  - lib/cucumber/core/test/empty_multiline_argument.rb
191
191
  - lib/cucumber/core/test/filters.rb
192
- - lib/cucumber/core/test/filters/activate_steps_for_self_test.rb
193
192
  - lib/cucumber/core/test/filters/locations_filter.rb
194
193
  - lib/cucumber/core/test/filters/name_filter.rb
195
194
  - lib/cucumber/core/test/filters/tag_filter.rb
@@ -218,15 +217,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
217
  requirements:
219
218
  - - ">="
220
219
  - !ruby/object:Gem::Version
221
- version: '2.5'
220
+ version: '2.7'
222
221
  required_rubygems_version: !ruby/object:Gem::Requirement
223
222
  requirements:
224
223
  - - ">="
225
224
  - !ruby/object:Gem::Version
226
- version: 3.0.1
225
+ version: 3.2.8
227
226
  requirements: []
228
227
  rubygems_version: 3.3.5
229
228
  signing_key:
230
229
  specification_version: 4
231
- summary: cucumber-core-13.0.3
230
+ summary: cucumber-core-14.0.0
232
231
  test_files: []
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cucumber/core/test/location'
4
- require 'cucumber/core/test/result'
5
- require 'cucumber/core/test/timer'
6
-
7
- module Cucumber
8
- module Core
9
- module Test
10
- class Action
11
- def initialize(location = nil, &block)
12
- raise ArgumentError, 'Passing a block to execute the action is mandatory.' unless block
13
-
14
- @location = location || Test::Location.new(*block.source_location)
15
- @block = block
16
- @timer = Timer.new
17
- end
18
-
19
- def skip(*)
20
- skipped
21
- end
22
-
23
- def execute(*args)
24
- @timer.start
25
- @block.call(*args)
26
- passed
27
- rescue Result::Raisable => exception
28
- exception.with_duration(@timer.duration)
29
- rescue Exception => exception
30
- failed(exception)
31
- end
32
-
33
- def location
34
- @location
35
- end
36
-
37
- def inspect
38
- "#<#{self.class}: #{location}>"
39
- end
40
-
41
- private
42
-
43
- def passed
44
- Result::Passed.new(@timer.duration)
45
- end
46
-
47
- def failed(exception)
48
- Result::Failed.new(@timer.duration, exception)
49
- end
50
-
51
- def skipped
52
- Result::Skipped.new
53
- end
54
- end
55
- end
56
- end
57
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cucumber/core/test/result'
4
-
5
- module Cucumber
6
- module Core
7
- module Test
8
- class UndefinedAction
9
- attr_reader :location
10
-
11
- def initialize(source_location)
12
- @location = source_location
13
- end
14
-
15
- def execute(*)
16
- undefined
17
- end
18
-
19
- def skip(*)
20
- undefined
21
- end
22
-
23
- private
24
-
25
- def undefined
26
- Result::Undefined.new
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cucumber/core/test/result'
4
- require 'cucumber/core/test/actions/action'
5
-
6
- module Cucumber
7
- module Core
8
- module Test
9
- class UnskippableAction < Action
10
- def skip(*args)
11
- execute(*args)
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'cucumber/core/test/location'
4
- require 'cucumber/core/test/result'
5
- require 'cucumber/core/test/timer'
6
-
7
- require 'cucumber/core/test/actions/action'
8
- require 'cucumber/core/test/actions/undefined_action'
9
- require 'cucumber/core/test/actions/unskippable_action'
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Cucumber
4
- module Core
5
- module Test
6
- module Filters
7
- # This filter is used for testing Cucumber itself. It adds step definitions
8
- # that will activate steps to have passed / failed / pending results
9
- # if they use conventional names.
10
- #
11
- # It was extracted from our test code, and does not have any tests of its own.
12
- class ActivateStepsForSelfTest < Core::Filter.new
13
- Failure = Class.new(StandardError)
14
-
15
- def test_case(test_case)
16
- test_case.with_steps(test_steps(test_case)).describe_to(receiver)
17
- end
18
-
19
- private
20
-
21
- def test_steps(test_case)
22
- test_case.test_steps.map do |step|
23
- case step.text
24
- when /fail/ then step.with_action { raise Failure }
25
- when /pending/ then step.with_action { raise Test::Result::Pending }
26
- when /pass/ then step.with_action { :no_op }
27
- else; step
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end