cucumber-core 3.0.0 → 3.1.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cucumber/core/version.rb +1 -1
  3. metadata +19 -85
  4. data/.coveralls.yml +0 -1
  5. data/.github/ISSUE_TEMPLATE.md +0 -48
  6. data/.github/PULL_REQUEST_TEMPLATE.md +0 -39
  7. data/.rspec +0 -1
  8. data/.ruby-gemset +0 -1
  9. data/.travis.yml +0 -30
  10. data/.yardopts +0 -6
  11. data/Gemfile +0 -2
  12. data/Rakefile +0 -28
  13. data/cucumber-core.gemspec +0 -36
  14. data/spec/capture_warnings.rb +0 -74
  15. data/spec/coverage.rb +0 -11
  16. data/spec/cucumber/core/ast/background_spec.rb +0 -11
  17. data/spec/cucumber/core/ast/data_table_spec.rb +0 -81
  18. data/spec/cucumber/core/ast/doc_string_spec.rb +0 -114
  19. data/spec/cucumber/core/ast/empty_multiline_argument_spec.rb +0 -28
  20. data/spec/cucumber/core/ast/examples_table_spec.rb +0 -113
  21. data/spec/cucumber/core/ast/location_spec.rb +0 -199
  22. data/spec/cucumber/core/ast/outline_step_spec.rb +0 -93
  23. data/spec/cucumber/core/ast/step_spec.rb +0 -174
  24. data/spec/cucumber/core/compiler_spec.rb +0 -267
  25. data/spec/cucumber/core/event_bus_spec.rb +0 -163
  26. data/spec/cucumber/core/event_spec.rb +0 -40
  27. data/spec/cucumber/core/filter_spec.rb +0 -101
  28. data/spec/cucumber/core/gherkin/parser_spec.rb +0 -261
  29. data/spec/cucumber/core/gherkin/writer_spec.rb +0 -333
  30. data/spec/cucumber/core/report/summary_spec.rb +0 -175
  31. data/spec/cucumber/core/test/action_spec.rb +0 -154
  32. data/spec/cucumber/core/test/case_spec.rb +0 -316
  33. data/spec/cucumber/core/test/duration_matcher.rb +0 -20
  34. data/spec/cucumber/core/test/filters/locations_filter_spec.rb +0 -405
  35. data/spec/cucumber/core/test/result_spec.rb +0 -474
  36. data/spec/cucumber/core/test/runner_spec.rb +0 -310
  37. data/spec/cucumber/core/test/step_spec.rb +0 -98
  38. data/spec/cucumber/core/test/timer_spec.rb +0 -25
  39. data/spec/cucumber/core_spec.rb +0 -262
  40. data/spec/readme_spec.rb +0 -37
  41. data/spec/report_api_spy.rb +0 -25
@@ -1,333 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'cucumber/core/gherkin/writer'
3
- require 'unindent'
4
-
5
- module Cucumber::Core::Gherkin
6
- describe Writer do
7
- include Writer
8
-
9
- context 'specifying uri' do
10
- it 'generates a uri by default' do
11
- source = gherkin { feature }
12
- expect( source.uri ).to eq 'features/test.feature'
13
- end
14
-
15
- it 'allows you to specify a URI' do
16
- source = gherkin('features/path/to/my.feature') { feature }
17
- expect( source.uri ).to eq 'features/path/to/my.feature'
18
- end
19
- end
20
-
21
- context 'a feature' do
22
-
23
- it 'generates the feature statement' do
24
- source = gherkin { feature }
25
- expect( source ).to eq "Feature:\n"
26
- end
27
-
28
- context 'when a name is provided' do
29
- it 'includes the name in the feature statement' do
30
- source = gherkin do
31
- feature "A Feature\n"
32
- end
33
- expect( source ).to eq "Feature: A Feature\n"
34
- end
35
- end
36
-
37
- context 'when a description is provided' do
38
- it 'includes the description in the feature statement' do
39
- source = gherkin do
40
- feature "A Feature", description: <<-END
41
- This is the description
42
- which can span
43
- multiple lines.
44
- END
45
- end
46
- expected = <<-END
47
- Feature: A Feature
48
- This is the description
49
- which can span
50
- multiple lines.
51
- END
52
-
53
- expect( source ).to eq expected.unindent
54
- end
55
- end
56
-
57
- context 'when a keyword is provided' do
58
- it 'uses the supplied keyword' do
59
- source = gherkin do
60
- feature "A Feature", keyword: "Business Need"
61
- end
62
- expect( source ).to eq "Business Need: A Feature\n"
63
- end
64
- end
65
-
66
- context 'when a language is supplied' do
67
- it 'inserts a language statement' do
68
- source = gherkin do
69
- feature language: 'ru'
70
- end
71
-
72
- expect( source ).to eq "# language: ru\nFeature:\n"
73
- end
74
- end
75
-
76
- context 'when a comment is supplied' do
77
- it 'inserts a comment' do
78
- source = gherkin do
79
- comment 'wow'
80
- comment 'great'
81
- feature
82
- end
83
-
84
- expect( source.to_s ).to eq "# wow\n# great\nFeature:\n"
85
- end
86
- end
87
-
88
- context 'with a scenario' do
89
- it 'includes the scenario statement' do
90
- source = gherkin do
91
- feature "A Feature" do
92
- scenario
93
- end
94
- end
95
-
96
- expect( source.to_s ).to match(/Scenario:/)
97
- end
98
-
99
- context 'when a comment is provided' do
100
- it 'includes the comment in the scenario statement' do
101
- source = gherkin do
102
- feature do
103
- comment 'wow'
104
- scenario
105
- end
106
- end
107
- expect( source.to_s ).to eq <<-END.unindent
108
- Feature:
109
-
110
- # wow
111
- Scenario:
112
- END
113
- end
114
- end
115
-
116
- context 'when a description is provided' do
117
- it 'includes the description in the scenario statement' do
118
- source = gherkin do
119
- feature do
120
- scenario description: <<-END
121
- This is the description
122
- which can span
123
- multiple lines.
124
- END
125
- end
126
- end
127
-
128
- expect( source ).to eq <<-END.unindent
129
- Feature:
130
-
131
- Scenario:
132
- This is the description
133
- which can span
134
- multiple lines.
135
- END
136
- end
137
- end
138
-
139
- context 'with a step' do
140
- it 'includes the step statement' do
141
- source = gherkin do
142
- feature "A Feature" do
143
- scenario do
144
- step 'passing'
145
- end
146
- end
147
- end
148
-
149
- expect( source.to_s ).to match(/Given passing\Z/m)
150
- end
151
-
152
- context 'when a docstring is provided' do
153
- it 'includes the content type when provided' do
154
- source = gherkin do
155
- feature do
156
- scenario do
157
- step 'failing' do
158
- doc_string 'some text', 'text/plain'
159
- end
160
- end
161
- end
162
-
163
- end
164
-
165
- expect( source ).to eq <<-END.unindent
166
- Feature:
167
-
168
- Scenario:
169
- Given failing
170
- """text/plain
171
- some text
172
- """
173
- END
174
- end
175
- end
176
- end
177
- end
178
-
179
- context 'with a background' do
180
- it 'can have a description' do
181
- source = gherkin do
182
- feature do
183
- background description: "One line,\nand two.."
184
- end
185
- end
186
-
187
- expect( source ).to eq <<-END.unindent
188
- Feature:
189
-
190
- Background:
191
- One line,
192
- and two..
193
- END
194
- end
195
- end
196
-
197
- context 'with a scenario outline' do
198
- it 'can have a description' do
199
- source = gherkin do
200
- feature do
201
- scenario_outline description: "Doesn't need to be multi-line."
202
- end
203
- end
204
-
205
- expect( source ).to eq <<-END.unindent
206
- Feature:
207
-
208
- Scenario Outline:
209
- Doesn't need to be multi-line.
210
- END
211
- end
212
-
213
- context 'and examples table' do
214
- it 'can have a description' do
215
- source = gherkin do
216
- feature do
217
- scenario_outline do
218
- examples description: "Doesn't need to be multi-line." do
219
-
220
- end
221
- end
222
- end
223
- end
224
-
225
- expect( source ).to eq <<-END.unindent
226
- Feature:
227
-
228
- Scenario Outline:
229
-
230
- Examples:
231
- Doesn't need to be multi-line.
232
- END
233
- end
234
- end
235
- end
236
- end
237
-
238
- it 'generates a complex feature' do
239
- source = gherkin do
240
- comment 'wow'
241
- feature 'Fully featured', language: 'en', tags: '@always' do
242
- comment 'cool'
243
- background do
244
- step 'passing'
245
- end
246
-
247
- scenario do
248
- step 'passing'
249
- end
250
-
251
- comment 'here'
252
- scenario 'with doc string', tags: '@first @second' do
253
- comment 'and here'
254
- step 'passing'
255
- step 'failing', keyword: 'When' do
256
- doc_string <<-END
257
- I wish I was a little bit taller.
258
- I wish I was a baller.
259
- END
260
- end
261
- end
262
-
263
- scenario 'with a table...' do
264
- step 'passes:' do
265
- table do
266
- row 'name', 'age', 'location'
267
- row 'Janine', '43', 'Antarctica'
268
- end
269
- end
270
- end
271
-
272
- comment 'yay'
273
- scenario_outline 'eating' do
274
- step 'there are <start> cucumbers'
275
- step 'I eat <eat> cucumbers', keyword: 'When'
276
- step 'I should have <left> cucumbers', keyword: 'Then'
277
-
278
- comment 'hmmm'
279
- examples do
280
- row 'start', 'eat', 'left'
281
- row '12', '5', '7'
282
- row '20', '5', '15'
283
- end
284
- end
285
- end
286
- end
287
-
288
- expect( source.to_s ).to eq <<-END.unindent
289
- # language: en
290
- # wow
291
- @always
292
- Feature: Fully featured
293
-
294
- # cool
295
- Background:
296
- Given passing
297
-
298
- Scenario:
299
- Given passing
300
-
301
- # here
302
- @first @second
303
- Scenario: with doc string
304
- # and here
305
- Given passing
306
- When failing
307
- """
308
- I wish I was a little bit taller.
309
- I wish I was a baller.
310
- """
311
-
312
- Scenario: with a table...
313
- Given passes:
314
- | name | age | location |
315
- | Janine | 43 | Antarctica |
316
-
317
- # yay
318
- Scenario Outline: eating
319
- Given there are <start> cucumbers
320
- When I eat <eat> cucumbers
321
- Then I should have <left> cucumbers
322
-
323
- # hmmm
324
- Examples:
325
- | start | eat | left |
326
- | 12 | 5 | 7 |
327
- | 20 | 5 | 15 |
328
- END
329
-
330
- end
331
- end
332
- end
333
-
@@ -1,175 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'cucumber/core/event_bus'
3
- require 'cucumber/core/events'
4
- require 'cucumber/core/report/summary'
5
- require 'cucumber/core/test/result'
6
-
7
- module Cucumber::Core::Report
8
- describe Summary do
9
- let(:event_bus) { ::Cucumber::Core::EventBus.new(registry) }
10
- let(:registry) { ::Cucumber::Core::Events.registry }
11
- let(:passed_result) { ::Cucumber::Core::Test::Result::Passed.new(duration) }
12
- let(:failed_result) { ::Cucumber::Core::Test::Result::Failed.new(duration, exception) }
13
- let(:pending_result) { ::Cucumber::Core::Test::Result::Pending.new(duration) }
14
- let(:skipped_result) { ::Cucumber::Core::Test::Result::Skipped.new(duration) }
15
- let(:undefined_result) { ::Cucumber::Core::Test::Result::Undefined.new(duration) }
16
- let(:duration) { double }
17
- let(:exception) { double }
18
-
19
- before(:each) { @summary = Summary.new(event_bus) }
20
-
21
- context "test case summary" do
22
- let(:test_case) { double }
23
-
24
- it "counts passed test cases" do
25
- event_bus.send(:test_case_finished, test_case, passed_result)
26
-
27
- expect( @summary.test_cases.total(:passed) ).to eq(1)
28
- expect( @summary.test_cases.total ).to eq(1)
29
- end
30
-
31
- it "counts failed test cases" do
32
- event_bus.send(:test_case_finished, test_case, failed_result)
33
-
34
- expect( @summary.test_cases.total(:failed) ).to eq(1)
35
- expect( @summary.test_cases.total ).to eq(1)
36
- end
37
-
38
- it "counts pending test cases" do
39
- event_bus.send(:test_case_finished, test_case, pending_result)
40
-
41
- expect( @summary.test_cases.total(:pending) ).to eq(1)
42
- expect( @summary.test_cases.total ).to eq(1)
43
- end
44
-
45
- it "counts skipped test cases" do
46
- event_bus.send(:test_case_finished, test_case, skipped_result)
47
-
48
- expect( @summary.test_cases.total(:skipped) ).to eq(1)
49
- expect( @summary.test_cases.total ).to eq(1)
50
- end
51
-
52
- it "counts undefined test cases" do
53
- event_bus.send(:test_case_finished, test_case, undefined_result)
54
-
55
- expect( @summary.test_cases.total(:undefined) ).to eq(1)
56
- expect( @summary.test_cases.total ).to eq(1)
57
- end
58
-
59
- it "handles flaky test cases" do
60
- allow(test_case).to receive(:==).and_return(false, true)
61
- event_bus.send(:test_case_finished, test_case, failed_result)
62
- event_bus.send(:test_case_finished, test_case, passed_result)
63
-
64
- expect( @summary.test_cases.total(:failed) ).to eq(0)
65
- expect( @summary.test_cases.total(:flaky) ).to eq(1)
66
- expect( @summary.test_cases.total ).to eq(1)
67
- end
68
- end
69
-
70
- context "test step summary" do
71
- context "with test steps from gherkin steps" do
72
- let(:test_step) { double }
73
-
74
- before(:each) do
75
- step = double
76
- expect( step ).to receive(:describe_to) do |visitor|
77
- visitor.step
78
- end
79
- expect( test_step ).to receive(:source).and_return([step])
80
- end
81
-
82
- it "counts passed test steps" do
83
- event_bus.send(:test_step_finished, test_step, passed_result)
84
-
85
- expect( @summary.test_steps.total(:passed) ).to eq(1)
86
- expect( @summary.test_steps.total ).to eq(1)
87
- end
88
-
89
- it "counts failed test cases" do
90
- event_bus.send(:test_step_finished, test_step, failed_result)
91
-
92
- expect( @summary.test_steps.total(:failed) ).to eq(1)
93
- expect( @summary.test_steps.total ).to eq(1)
94
- end
95
-
96
- it "counts pending test cases" do
97
- event_bus.send(:test_step_finished, test_step, pending_result)
98
-
99
- expect( @summary.test_steps.total(:pending) ).to eq(1)
100
- expect( @summary.test_steps.total ).to eq(1)
101
- end
102
-
103
- it "counts skipped test cases" do
104
- event_bus.send(:test_step_finished, test_step, skipped_result)
105
-
106
- expect( @summary.test_steps.total(:skipped) ).to eq(1)
107
- expect( @summary.test_steps.total ).to eq(1)
108
- end
109
-
110
- it "counts undefined test cases" do
111
- event_bus.send(:test_step_finished, test_step, undefined_result)
112
-
113
- expect( @summary.test_steps.total(:undefined) ).to eq(1)
114
- expect( @summary.test_steps.total ).to eq(1)
115
- end
116
- end
117
-
118
- context "with test steps not from gherkin steps" do
119
- let(:test_step) { double }
120
-
121
- before(:each) do
122
- step = double
123
- expect( step ).to receive(:describe_to) do |visitor|
124
- visitor.not_step
125
- end
126
- expect( test_step ).to receive(:source).and_return([step])
127
- end
128
-
129
- it "ignores test steps not defined by gherkin steps" do
130
- event_bus.send(:test_step_finished, test_step, passed_result)
131
-
132
- expect( @summary.test_steps.total ).to eq(0)
133
- end
134
- end
135
- end
136
-
137
- context "ok? result" do
138
- let(:test_case) { double }
139
-
140
- it "passed test case is ok" do
141
- event_bus.send(:test_case_finished, test_case, passed_result)
142
-
143
- expect( @summary.ok? ).to eq true
144
- end
145
-
146
- it "skipped test case is ok" do
147
- event_bus.send(:test_case_finished, test_case, skipped_result)
148
-
149
- expect( @summary.ok? ).to eq true
150
- end
151
-
152
- it "failed test case is not ok" do
153
- event_bus.send(:test_case_finished, test_case, failed_result)
154
-
155
- expect( @summary.ok? ).to eq false
156
- end
157
-
158
- it "pending test case is ok if not strict" do
159
- event_bus.send(:test_case_finished, test_case, pending_result)
160
-
161
- expect( @summary.ok? ).to eq true
162
- be_strict = ::Cucumber::Core::Test::Result::StrictConfiguration.new([:pending])
163
- expect( @summary.ok?(be_strict) ).to eq false
164
- end
165
-
166
- it "undefined test case is ok if not strict" do
167
- event_bus.send(:test_case_finished, test_case, undefined_result)
168
-
169
- expect( @summary.ok? ).to eq true
170
- be_strict = ::Cucumber::Core::Test::Result::StrictConfiguration.new([:undefined])
171
- expect( @summary.ok?(be_strict) ).to eq false
172
- end
173
- end
174
- end
175
- end