cucumber-core 11.0.0 → 11.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +204 -291
  3. data/README.md +0 -1
  4. data/lib/cucumber/core/test/case.rb +11 -1
  5. data/lib/cucumber/core/test/data_table.rb +4 -0
  6. data/lib/cucumber/core/test/doc_string.rb +4 -1
  7. data/lib/cucumber/core/test/empty_multiline_argument.rb +2 -2
  8. data/lib/cucumber/core/test/filters/locations_filter.rb +1 -1
  9. data/lib/cucumber/core/test/location.rb +7 -0
  10. data/lib/cucumber/core/test/step.rb +4 -0
  11. metadata +21 -86
  12. data/lib/cucumber/core/version.rb +0 -10
  13. data/spec/coverage.rb +0 -12
  14. data/spec/cucumber/core/compiler_spec.rb +0 -241
  15. data/spec/cucumber/core/event_bus_spec.rb +0 -163
  16. data/spec/cucumber/core/event_spec.rb +0 -40
  17. data/spec/cucumber/core/filter_spec.rb +0 -101
  18. data/spec/cucumber/core/gherkin/parser_spec.rb +0 -162
  19. data/spec/cucumber/core/gherkin/writer_spec.rb +0 -332
  20. data/spec/cucumber/core/report/summary_spec.rb +0 -178
  21. data/spec/cucumber/core/test/action_spec.rb +0 -153
  22. data/spec/cucumber/core/test/case_spec.rb +0 -125
  23. data/spec/cucumber/core/test/data_table_spec.rb +0 -79
  24. data/spec/cucumber/core/test/doc_string_spec.rb +0 -111
  25. data/spec/cucumber/core/test/duration_matcher.rb +0 -20
  26. data/spec/cucumber/core/test/empty_multiline_argument_spec.rb +0 -28
  27. data/spec/cucumber/core/test/filters/locations_filter_spec.rb +0 -271
  28. data/spec/cucumber/core/test/location_spec.rb +0 -129
  29. data/spec/cucumber/core/test/result_spec.rb +0 -504
  30. data/spec/cucumber/core/test/runner_spec.rb +0 -320
  31. data/spec/cucumber/core/test/step_spec.rb +0 -88
  32. data/spec/cucumber/core/test/timer_spec.rb +0 -25
  33. data/spec/cucumber/core_spec.rb +0 -262
  34. data/spec/report_api_spy.rb +0 -25
@@ -19,8 +19,8 @@ module Cucumber
19
19
  self
20
20
  end
21
21
 
22
- def all_locations
23
- []
22
+ def lines_count
23
+ 0
24
24
  end
25
25
 
26
26
  def inspect
@@ -26,7 +26,7 @@ module Cucumber
26
26
  def sorted_test_cases
27
27
  filter_locations.map { |filter_location|
28
28
  test_cases[filter_location.file].select { |test_case|
29
- filter_location.match?(test_case.location)
29
+ test_case.match_locations?([filter_location])
30
30
  }
31
31
  }.flatten.uniq
32
32
  end
@@ -79,6 +79,13 @@ module Cucumber
79
79
  to_s
80
80
  end
81
81
 
82
+ def merge(multiline_arg)
83
+ new_lines = (0..multiline_arg.lines_count).map do |offset|
84
+ lines.min + offset
85
+ end
86
+ Location.new(file, new_lines)
87
+ end
88
+
82
89
  def on_line(new_line)
83
90
  Location.new(file, new_line)
84
91
  end
@@ -51,6 +51,10 @@ module Cucumber
51
51
  @action.location
52
52
  end
53
53
 
54
+ def matching_locations
55
+ [location.merge(multiline_arg)]
56
+ end
57
+
54
58
  def inspect
55
59
  "#<#{self.class}: #{location}>"
56
60
  end
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: 11.0.0
4
+ version: 11.1.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: 2022-05-18 00:00:00.000000000 Z
15
+ date: 2022-12-23 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
- - - "~>"
22
- - !ruby/object:Gem::Version
23
- version: '23.0'
24
21
  - - ">="
25
22
  - !ruby/object:Gem::Version
26
- version: 23.0.1
23
+ version: '24'
24
+ - - "<"
25
+ - !ruby/object:Gem::Version
26
+ version: '27'
27
27
  type: :runtime
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '23.0'
34
31
  - - ">="
35
32
  - !ruby/object:Gem::Version
36
- version: 23.0.1
33
+ version: '24'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '27'
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: cucumber-messages
39
39
  requirement: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: '18.0'
44
41
  - - ">="
45
42
  - !ruby/object:Gem::Version
46
- version: 18.0.0
43
+ version: '19'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '22'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '18.0'
54
51
  - - ">="
55
52
  - !ruby/object:Gem::Version
56
- version: 18.0.0
53
+ version: '19'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '22'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: cucumber-tag-expressions
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -74,26 +74,6 @@ dependencies:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: 4.1.0
77
- - !ruby/object:Gem::Dependency
78
- name: coveralls
79
- requirement: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '0.8'
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: 0.8.23
87
- type: :development
88
- prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - "~>"
92
- - !ruby/object:Gem::Version
93
- version: '0.8'
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 0.8.23
97
77
  - !ruby/object:Gem::Dependency
98
78
  name: rake
99
79
  requirement: !ruby/object:Gem::Requirement
@@ -233,29 +213,6 @@ files:
233
213
  - lib/cucumber/core/test/step.rb
234
214
  - lib/cucumber/core/test/tag.rb
235
215
  - lib/cucumber/core/test/timer.rb
236
- - lib/cucumber/core/version.rb
237
- - spec/coverage.rb
238
- - spec/cucumber/core/compiler_spec.rb
239
- - spec/cucumber/core/event_bus_spec.rb
240
- - spec/cucumber/core/event_spec.rb
241
- - spec/cucumber/core/filter_spec.rb
242
- - spec/cucumber/core/gherkin/parser_spec.rb
243
- - spec/cucumber/core/gherkin/writer_spec.rb
244
- - spec/cucumber/core/report/summary_spec.rb
245
- - spec/cucumber/core/test/action_spec.rb
246
- - spec/cucumber/core/test/case_spec.rb
247
- - spec/cucumber/core/test/data_table_spec.rb
248
- - spec/cucumber/core/test/doc_string_spec.rb
249
- - spec/cucumber/core/test/duration_matcher.rb
250
- - spec/cucumber/core/test/empty_multiline_argument_spec.rb
251
- - spec/cucumber/core/test/filters/locations_filter_spec.rb
252
- - spec/cucumber/core/test/location_spec.rb
253
- - spec/cucumber/core/test/result_spec.rb
254
- - spec/cucumber/core/test/runner_spec.rb
255
- - spec/cucumber/core/test/step_spec.rb
256
- - spec/cucumber/core/test/timer_spec.rb
257
- - spec/cucumber/core_spec.rb
258
- - spec/report_api_spy.rb
259
216
  homepage: https://cucumber.io
260
217
  licenses:
261
218
  - MIT
@@ -281,30 +238,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
238
  - !ruby/object:Gem::Version
282
239
  version: '0'
283
240
  requirements: []
284
- rubygems_version: 3.1.2
241
+ rubygems_version: 3.3.5
285
242
  signing_key:
286
243
  specification_version: 4
287
- summary: cucumber-core-11.0.0
288
- test_files:
289
- - spec/cucumber/core/filter_spec.rb
290
- - spec/cucumber/core/test/duration_matcher.rb
291
- - spec/cucumber/core/test/empty_multiline_argument_spec.rb
292
- - spec/cucumber/core/test/doc_string_spec.rb
293
- - spec/cucumber/core/test/data_table_spec.rb
294
- - spec/cucumber/core/test/timer_spec.rb
295
- - spec/cucumber/core/test/case_spec.rb
296
- - spec/cucumber/core/test/runner_spec.rb
297
- - spec/cucumber/core/test/action_spec.rb
298
- - spec/cucumber/core/test/filters/locations_filter_spec.rb
299
- - spec/cucumber/core/test/result_spec.rb
300
- - spec/cucumber/core/test/location_spec.rb
301
- - spec/cucumber/core/test/step_spec.rb
302
- - spec/cucumber/core/gherkin/parser_spec.rb
303
- - spec/cucumber/core/gherkin/writer_spec.rb
304
- - spec/cucumber/core/report/summary_spec.rb
305
- - spec/cucumber/core/event_spec.rb
306
- - spec/cucumber/core/event_bus_spec.rb
307
- - spec/cucumber/core/compiler_spec.rb
308
- - spec/cucumber/core_spec.rb
309
- - spec/report_api_spy.rb
310
- - spec/coverage.rb
244
+ summary: cucumber-core-11.1.0
245
+ test_files: []
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
- module Cucumber
3
- module Core
4
- class Version
5
- def self.to_s
6
- "11.0.0"
7
- end
8
- end
9
- end
10
- end
data/spec/coverage.rb DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rubygems'
3
- require 'simplecov'
4
- formatters = [ SimpleCov::Formatter::HTMLFormatter ]
5
-
6
- if ENV['TRAVIS']
7
- require 'coveralls'
8
- formatters << Coveralls::SimpleCov::Formatter
9
- end
10
-
11
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(formatters)
12
- SimpleCov.start
@@ -1,241 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'cucumber/core'
3
- require 'cucumber/core/compiler'
4
- require 'cucumber/core/gherkin/writer'
5
-
6
- module Cucumber::Core
7
- describe Compiler do
8
- include Gherkin::Writer
9
- include Cucumber::Core
10
-
11
- def self.stubs(*names)
12
- names.each do |name|
13
- let(name) { double(name.to_s) }
14
- end
15
- end
16
-
17
- it "compiles a feature with a single scenario" do
18
- gherkin_documents = [
19
- gherkin do
20
- feature do
21
- scenario do
22
- step 'passing'
23
- end
24
- end
25
- end
26
- ]
27
- compile(gherkin_documents) do |visitor|
28
- expect( visitor ).to receive(:test_case).once.ordered.and_yield(visitor)
29
- expect( visitor ).to receive(:test_step).once.ordered
30
- expect( visitor ).to receive(:done).once.ordered
31
- end
32
- end
33
-
34
- context "when the event_bus is provided" do
35
- let(:event_bus) { double }
36
-
37
- before do
38
- allow( event_bus ).to receive(:envelope)
39
- allow( event_bus ).to receive(:gherkin_source_parsed).and_return(nil)
40
- allow( event_bus ).to receive(:test_case_created).and_return(nil)
41
- allow( event_bus ).to receive(:test_step_created).and_return(nil)
42
- end
43
-
44
- it "emits a TestCaseCreated event with the created Test::Case and Pickle" do
45
- gherkin_documents = [
46
- gherkin do
47
- feature do
48
- scenario do
49
- step 'passing'
50
- end
51
- end
52
- end
53
- ]
54
-
55
- compile(gherkin_documents, event_bus) do |visitor|
56
- allow( visitor ).to receive(:test_case)
57
- allow( visitor ).to receive(:test_step)
58
- allow( visitor ).to receive(:done)
59
- allow( event_bus ).to receive(:envelope)
60
-
61
- expect( event_bus ).to receive(:test_case_created).once
62
- end
63
- end
64
-
65
- it "emits a TestStepCreated event with the created Test::Step and PickleStep" do
66
- gherkin_documents = [
67
- gherkin do
68
- feature do
69
- scenario do
70
- step 'passing'
71
- step 'passing'
72
- end
73
- end
74
- end
75
- ]
76
-
77
- compile(gherkin_documents, event_bus) do |visitor|
78
- allow( visitor ).to receive(:test_case)
79
- allow( visitor ).to receive(:test_step)
80
- allow( visitor ).to receive(:done)
81
- allow( event_bus ).to receive(:envelope)
82
-
83
- expect( event_bus ).to receive(:test_step_created).twice
84
- end
85
- end
86
- end
87
-
88
- it "compiles a feature with a background" do
89
- gherkin_documents = [
90
- gherkin do
91
- feature do
92
- background do
93
- step 'passing'
94
- end
95
-
96
- scenario do
97
- step 'passing'
98
- end
99
- end
100
- end
101
- ]
102
- compile(gherkin_documents) do |visitor|
103
- expect( visitor ).to receive(:test_case).once.ordered.and_yield(visitor)
104
- expect( visitor ).to receive(:test_step).exactly(2).times.ordered
105
- expect( visitor ).to receive(:done).once.ordered
106
- end
107
- end
108
-
109
- it "compiles multiple features" do
110
- gherkin_documents = [
111
- gherkin do
112
- feature do
113
- background do
114
- step 'passing'
115
- end
116
- scenario do
117
- step 'passing'
118
- end
119
- end
120
- end,
121
- gherkin do
122
- feature do
123
- background do
124
- step 'passing'
125
- end
126
- scenario do
127
- step 'passing'
128
- end
129
- end
130
- end
131
- ]
132
- compile(gherkin_documents) do |visitor|
133
- expect( visitor ).to receive(:test_case).once.ordered
134
- expect( visitor ).to receive(:test_step).twice.ordered
135
- expect( visitor ).to receive(:test_case).once.ordered
136
- expect( visitor ).to receive(:test_step).twice.ordered
137
- expect( visitor ).to receive(:done).once
138
- end
139
- end
140
-
141
- context "compiling scenario outlines" do
142
- it "compiles a scenario outline to test cases" do
143
- gherkin_documents = [
144
- gherkin do
145
- feature do
146
- background do
147
- step 'passing'
148
- end
149
-
150
- scenario_outline do
151
- step 'passing <arg>'
152
- step 'passing'
153
-
154
- examples 'examples 1' do
155
- row 'arg'
156
- row '1'
157
- row '2'
158
- end
159
-
160
- examples 'examples 2' do
161
- row 'arg'
162
- row 'a'
163
- end
164
- end
165
- end
166
- end
167
- ]
168
- compile(gherkin_documents) do |visitor|
169
- expect( visitor ).to receive(:test_case).exactly(3).times.and_yield(visitor)
170
- expect( visitor ).to receive(:test_step).exactly(9).times
171
- expect( visitor ).to receive(:done).once
172
- end
173
- end
174
-
175
- it 'replaces arguments correctly when generating test steps' do
176
- gherkin_documents = [
177
- gherkin do
178
- feature do
179
- scenario_outline do
180
- step 'passing <arg1> with <arg2>'
181
- step 'as well as <arg3>'
182
-
183
- examples do
184
- row 'arg1', 'arg2', 'arg3'
185
- row '1', '2', '3'
186
- end
187
- end
188
- end
189
- end
190
- ]
191
-
192
- compile(gherkin_documents) do |visitor|
193
- expect( visitor ).to receive(:test_step) do |test_step|
194
- expect(test_step.text).to eq 'passing 1 with 2'
195
- end.once.ordered
196
-
197
- expect( visitor ).to receive(:test_step) do |test_step|
198
- expect(test_step.text).to eq 'as well as 3'
199
- end.once.ordered
200
-
201
- expect( visitor ).to receive(:done).once.ordered
202
- end
203
- end
204
- end
205
-
206
- context 'empty scenarios' do
207
- it 'does create test cases for them' do
208
- gherkin_documents = [
209
- gherkin do
210
- feature do
211
- scenario do
212
- end
213
- end
214
- end
215
- ]
216
- compile(gherkin_documents) do |visitor|
217
- expect( visitor ).to receive(:test_case).once.ordered
218
- expect( visitor ).to receive(:done).once.ordered
219
- end
220
- end
221
- end
222
-
223
- def compile(gherkin_documents, event_bus = nil)
224
- visitor = double
225
- allow( visitor ).to receive(:test_suite).and_yield(visitor)
226
- allow( visitor ).to receive(:test_case).and_yield(visitor)
227
-
228
- if event_bus.nil?
229
- event_bus = double
230
- allow( event_bus ).to receive(:envelope).and_return(nil)
231
- allow( event_bus ).to receive(:gherkin_source_parsed).and_return(nil)
232
- allow( event_bus ).to receive(:test_case_created).and_return(nil)
233
- allow( event_bus ).to receive(:test_step_created).and_return(nil)
234
- allow( event_bus ).to receive(:envelope).and_return(nil)
235
- end
236
-
237
- yield visitor
238
- super(gherkin_documents, visitor, [], event_bus)
239
- end
240
- end
241
- end
@@ -1,163 +0,0 @@
1
- require "cucumber/core/event_bus"
2
-
3
- module Cucumber
4
- module Core
5
- module Events
6
-
7
- class TestEvent < Core::Event.new(:some_attribute)
8
- end
9
-
10
- AnotherTestEvent = Core::Event.new
11
-
12
- UnregisteredEvent = Core::Event.new
13
- end
14
-
15
- describe EventBus do
16
- let(:event_bus) { EventBus.new(registry) }
17
- let(:registry) { { test_event: Events::TestEvent, another_test_event: Events::AnotherTestEvent } }
18
-
19
- context "broadcasting events" do
20
-
21
- it "can broadcast by calling a method named after the event ID" do
22
- called = false
23
- event_bus.on(:test_event) {called = true }
24
- event_bus.test_event
25
- expect(called).to be true
26
- end
27
-
28
- it "can broadcast by calling the `broadcast` method with an instance of the event type" do
29
- called = false
30
- event_bus.on(:test_event) {called = true }
31
- event_bus.broadcast(Events::TestEvent.new(:some_attribute))
32
- expect(called).to be true
33
- end
34
-
35
- it "calls a subscriber for an event, passing details of the event" do
36
- received_payload = nil
37
- event_bus.on :test_event do |event|
38
- received_payload = event
39
- end
40
-
41
- event_bus.test_event :some_attribute
42
-
43
- expect(received_payload.some_attribute).to eq(:some_attribute)
44
- end
45
-
46
- it "does not call subscribers for other events" do
47
- handler_called = false
48
- event_bus.on :test_event do
49
- handler_called = true
50
- end
51
-
52
- event_bus.another_test_event
53
-
54
- expect(handler_called).to eq(false)
55
- end
56
-
57
- it "broadcasts to multiple subscribers" do
58
- received_events = []
59
- event_bus.on :test_event do
60
- received_events << :event
61
- end
62
- event_bus.on :test_event do
63
- received_events << :event
64
- end
65
-
66
- event_bus.test_event(:some_attribute)
67
-
68
- expect(received_events.length).to eq 2
69
- end
70
-
71
- it "raises an error when given an event to broadcast that it doesn't recognise" do
72
- expect { event_bus.some_unknown_event }.to raise_error(NameError)
73
- end
74
-
75
- context "#broadcast method" do
76
- it "must be passed an instance of a registered event type" do
77
- expect {
78
- event_bus.broadcast Events::UnregisteredEvent
79
- }.to raise_error(ArgumentError)
80
- end
81
- end
82
-
83
- end
84
-
85
- context "subscribing to events" do
86
- it "allows subscription by symbol (Event ID)" do
87
- received_payload = nil
88
- event_bus.on(:test_event) do |event|
89
- received_payload = event
90
- end
91
-
92
- event_bus.test_event :some_attribute
93
-
94
- expect(received_payload.some_attribute).to eq(:some_attribute)
95
- end
96
-
97
- it "raises an error if you use an unknown Event ID" do
98
- expect {
99
- event_bus.on(:some_unknown_event) { :whatever }
100
- }.to raise_error(ArgumentError)
101
- end
102
-
103
- it "allows handlers that are objects with a `call` method" do
104
- class MyHandler
105
- attr_reader :received_payload
106
-
107
- def call(event)
108
- @received_payload = event
109
- end
110
- end
111
-
112
- handler = MyHandler.new
113
- event_bus.on(:test_event, handler)
114
-
115
- event_bus.test_event :some_attribute
116
-
117
- expect(handler.received_payload.some_attribute).to eq :some_attribute
118
- end
119
-
120
- it "allows handlers that are procs" do
121
- class MyProccyHandler
122
- attr_reader :received_payload
123
-
124
- def initialize(event_bus)
125
- event_bus.on :test_event, &method(:on_test_event)
126
- end
127
-
128
- def on_test_event(event)
129
- @received_payload = event
130
- end
131
- end
132
-
133
- handler = MyProccyHandler.new(event_bus)
134
-
135
- event_bus.test_event :some_attribute
136
- expect(handler.received_payload.some_attribute).to eq :some_attribute
137
- end
138
-
139
- it "sends events that were broadcast before you subscribed" do
140
- event_bus.test_event :some_attribute
141
- event_bus.another_test_event
142
-
143
- received_payload = nil
144
- event_bus.on(:test_event) do |event|
145
- received_payload = event
146
- end
147
-
148
- expect(received_payload.some_attribute).to eq(:some_attribute)
149
- end
150
-
151
- end
152
-
153
- it "will let you inspect the registry" do
154
- expect(event_bus.event_types[:test_event]).to eq Events::TestEvent
155
- end
156
-
157
- it "won't let you modify the registry" do
158
- expect { event_bus.event_types[:foo] = :bar }.to raise_error(RuntimeError)
159
- end
160
-
161
- end
162
- end
163
- end
@@ -1,40 +0,0 @@
1
- require 'cucumber/core/event'
2
-
3
- module Cucumber
4
- module Core
5
- describe Event do
6
-
7
- describe ".new" do
8
- it "generates new types of events" do
9
- my_event_type = Event.new
10
- my_event = my_event_type.new
11
- expect(my_event).to be_kind_of(Core::Event)
12
- end
13
-
14
- it "generates events with attributes" do
15
- my_event_type = Event.new(:foo, :bar)
16
- my_event = my_event_type.new(1, 2)
17
- expect(my_event.attributes).to eq [1, 2]
18
- expect(my_event.foo).to eq 1
19
- expect(my_event.bar).to eq 2
20
- end
21
- end
22
-
23
- describe "a generated event" do
24
- class MyEventType < Event.new(:foo, :bar)
25
- end
26
-
27
- it "can be converted to a hash" do
28
- my_event = MyEventType.new(1, 2)
29
- expect(my_event.to_h).to eq foo: 1, bar: 2
30
- end
31
-
32
- it "has an event_id" do
33
- expect(MyEventType.event_id).to eq :my_event_type
34
- expect(MyEventType.new(1, 2).event_id).to eq :my_event_type
35
- end
36
- end
37
- end
38
-
39
- end
40
- end