cucumber-core 1.2.0 → 1.3.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 +4 -4
- data/HISTORY.md +10 -2
- data/cucumber-core.gemspec +1 -1
- data/lib/cucumber/core/ast/background.rb +3 -6
- data/lib/cucumber/core/ast/data_table.rb +2 -7
- data/lib/cucumber/core/ast/describes_itself.rb +5 -1
- data/lib/cucumber/core/ast/doc_string.rb +2 -2
- data/lib/cucumber/core/ast/examples_table.rb +3 -3
- data/lib/cucumber/core/ast/feature.rb +14 -5
- data/lib/cucumber/core/ast/location.rb +19 -6
- data/lib/cucumber/core/ast/outline_step.rb +4 -5
- data/lib/cucumber/core/ast/scenario.rb +4 -8
- data/lib/cucumber/core/ast/scenario_outline.rb +4 -10
- data/lib/cucumber/core/ast/step.rb +9 -8
- data/lib/cucumber/core/gherkin/ast_builder.rb +241 -217
- data/lib/cucumber/core/gherkin/parser.rb +16 -16
- data/lib/cucumber/core/gherkin/tag_expression.rb +64 -0
- data/lib/cucumber/core/test/case.rb +2 -2
- data/lib/cucumber/core/test/runner.rb +9 -4
- data/lib/cucumber/core/test/step.rb +19 -0
- data/lib/cucumber/core/version.rb +1 -1
- data/spec/cucumber/core/ast/background_spec.rb +1 -1
- data/spec/cucumber/core/ast/location_spec.rb +45 -0
- data/spec/cucumber/core/ast/outline_step_spec.rb +3 -4
- data/spec/cucumber/core/ast/step_spec.rb +22 -20
- data/spec/cucumber/core/gherkin/parser_spec.rb +36 -7
- data/spec/cucumber/core/test/case_spec.rb +10 -0
- data/spec/cucumber/core/test/filters/locations_filter_spec.rb +40 -3
- data/spec/cucumber/core/test/runner_spec.rb +16 -0
- metadata +7 -6
@@ -334,6 +334,16 @@ module Cucumber
|
|
334
334
|
location = Ast::Location.new(file, 18)
|
335
335
|
expect( test_case.match_locations?([location]) ).to be_truthy
|
336
336
|
end
|
337
|
+
|
338
|
+
it "matches a location at the end of the docstring" do
|
339
|
+
location = Ast::Location.new(file, 19)
|
340
|
+
expect( test_case.match_locations?([location]) ).to be_truthy
|
341
|
+
end
|
342
|
+
|
343
|
+
it "does not match a location after the docstring" do
|
344
|
+
location = Ast::Location.new(file, 20)
|
345
|
+
expect( test_case.match_locations?([location]) ).to be_falsy
|
346
|
+
end
|
337
347
|
end
|
338
348
|
|
339
349
|
context "with a table" do
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'cucumber/core/gherkin/writer'
|
2
2
|
require 'cucumber/core'
|
3
3
|
require 'cucumber/core/test/filters/locations_filter'
|
4
|
+
require 'timeout'
|
4
5
|
|
5
6
|
module Cucumber::Core::Test
|
6
7
|
describe LocationsFilter do
|
@@ -10,7 +11,7 @@ module Cucumber::Core::Test
|
|
10
11
|
let(:receiver) { SpyReceiver.new }
|
11
12
|
|
12
13
|
let(:doc) do
|
13
|
-
gherkin do
|
14
|
+
gherkin('features/test.feature') do
|
14
15
|
feature do
|
15
16
|
scenario 'x' do
|
16
17
|
step 'a step'
|
@@ -51,6 +52,44 @@ module Cucumber::Core::Test
|
|
51
52
|
expect(receiver.test_case_locations).to eq ["features/test.feature:3"]
|
52
53
|
end
|
53
54
|
|
55
|
+
num_features = 1
|
56
|
+
num_scenarios_per_feature = 300
|
57
|
+
context "under load" do
|
58
|
+
let(:docs) do
|
59
|
+
(1..num_features).map do |i|
|
60
|
+
gherkin("features/test_#{i}.feature") do
|
61
|
+
feature do
|
62
|
+
(1..num_scenarios_per_feature).each do |j|
|
63
|
+
scenario "scenario #{j}" do
|
64
|
+
step
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
num_locations = num_features
|
73
|
+
let(:locations) do
|
74
|
+
(1..num_locations).map do |i|
|
75
|
+
(1..num_scenarios_per_feature).map do |j|
|
76
|
+
line = 3 + (j - 1) * 3
|
77
|
+
Cucumber::Core::Ast::Location.new("features/test_#{i}.feature", line)
|
78
|
+
end
|
79
|
+
end.flatten
|
80
|
+
end
|
81
|
+
|
82
|
+
max_duration_ms = 10000
|
83
|
+
it "filters #{num_features * num_scenarios_per_feature} test cases within #{max_duration_ms}ms" do
|
84
|
+
filter = LocationsFilter.new(locations)
|
85
|
+
Timeout.timeout(max_duration_ms / 1000.0) do
|
86
|
+
compile docs, receiver, [filter]
|
87
|
+
end
|
88
|
+
expect(receiver.test_cases.length).to eq num_features * num_scenarios_per_feature
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
54
93
|
class SpyReceiver
|
55
94
|
def test_case(test_case)
|
56
95
|
test_cases << test_case
|
@@ -63,8 +102,6 @@ module Cucumber::Core::Test
|
|
63
102
|
test_cases.map(&:location).map(&:to_s)
|
64
103
|
end
|
65
104
|
|
66
|
-
private
|
67
|
-
|
68
105
|
def test_cases
|
69
106
|
@test_cases ||= []
|
70
107
|
end
|
@@ -297,6 +297,22 @@ module Cucumber::Core::Test
|
|
297
297
|
end
|
298
298
|
test_case.describe_to runner
|
299
299
|
end
|
300
|
+
|
301
|
+
it "sends after_test_step for a step interrupted by (a timeout in) the around hook" do
|
302
|
+
around_hook = AroundHook.new { |block| block.call; raise exception }
|
303
|
+
passing_step = Step.new([source]).with_action {}
|
304
|
+
test_case = Case.new([], source, [around_hook])
|
305
|
+
allow(runner).to receive(:running_test_step).and_return(passing_step)
|
306
|
+
expect(report).to receive(:after_test_step).with(passing_step, anything) do |reported_test_case, result|
|
307
|
+
expect(result).to be_failed
|
308
|
+
expect(result.exception).to eq exception
|
309
|
+
end
|
310
|
+
expect(report).to receive(:after_test_case).with(test_case, anything) do |reported_test_case, result|
|
311
|
+
expect(result).to be_failed
|
312
|
+
expect(result.exception).to eq exception
|
313
|
+
end
|
314
|
+
test_case.describe_to runner
|
315
|
+
end
|
300
316
|
end
|
301
317
|
|
302
318
|
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: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
@@ -12,22 +12,22 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
|
-
name:
|
18
|
+
name: gherkin3
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - "~>"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 3.1.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - "~>"
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
30
|
+
version: 3.1.0
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: bundler
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- lib/cucumber/core/gherkin/ast_builder.rb
|
154
154
|
- lib/cucumber/core/gherkin/document.rb
|
155
155
|
- lib/cucumber/core/gherkin/parser.rb
|
156
|
+
- lib/cucumber/core/gherkin/tag_expression.rb
|
156
157
|
- lib/cucumber/core/gherkin/writer.rb
|
157
158
|
- lib/cucumber/core/gherkin/writer/helpers.rb
|
158
159
|
- lib/cucumber/core/platform.rb
|
@@ -218,7 +219,7 @@ rubyforge_project:
|
|
218
219
|
rubygems_version: 2.2.2
|
219
220
|
signing_key:
|
220
221
|
specification_version: 4
|
221
|
-
summary: cucumber-core-1.
|
222
|
+
summary: cucumber-core-1.3.0
|
222
223
|
test_files:
|
223
224
|
- spec/capture_warnings.rb
|
224
225
|
- spec/coverage.rb
|