cucumber-core 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +7 -1
- data/lib/cucumber/core/ast/doc_string.rb +1 -1
- data/lib/cucumber/core/gherkin/writer/helpers.rb +1 -6
- data/lib/cucumber/core/test/filters/locations_filter.rb +26 -2
- data/lib/cucumber/core/version.rb +1 -1
- data/spec/cucumber/core/ast/doc_string_spec.rb +2 -2
- data/spec/cucumber/core/test/filters/locations_filter_spec.rb +74 -0
- data/spec/cucumber/core_spec.rb +0 -25
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5c7dce2de4429c75212c41a7d68768df625b22e
|
4
|
+
data.tar.gz: a1b973e289c386411ec84f27cc83db1b2ad4e147
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20196a25adcfb5fe2bba86beb60ac8d1e8472e89b280add560da96737cb2e1bdb8b0c6a60e9438dc981a74669629dbb0f9336c34fcb502a8b55b5cffdfa92e0c
|
7
|
+
data.tar.gz: d01388ba71e8e2e09f7286d1425406db8f0d72b44805d49261eec7b6e0be2b934c10e6cc465f04a81893c2688f2293d7774bc9c330d1dcba26c9a174c79f132f
|
data/HISTORY.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
## [In Git](https://github.com/cucumber/cucumber-ruby-core/compare/v1.
|
1
|
+
## [In Git](https://github.com/cucumber/cucumber-ruby-core/compare/v1.1.0...master)
|
2
|
+
|
3
|
+
## [In Git](https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0...v1.1.0)
|
4
|
+
|
5
|
+
### New features
|
6
|
+
|
7
|
+
* LocationsFilter now sorts test cases as well as filtering them (@mattwynne)
|
2
8
|
|
3
9
|
## [v1.0.0](https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0.beta.4...v1.0.0)
|
4
10
|
|
@@ -62,12 +62,7 @@ module Cucumber
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def slurp_comments
|
65
|
-
|
66
|
-
# When we use the comments, we need to reset the collection
|
67
|
-
# for the next element...
|
68
|
-
slurped_comments = comment_lines.dup
|
69
|
-
@comment_lines = nil
|
70
|
-
slurped_comments
|
65
|
+
comment_lines.tap { @comment_lines = nil }
|
71
66
|
end
|
72
67
|
end
|
73
68
|
|
@@ -3,15 +3,39 @@ require 'cucumber/core/filter'
|
|
3
3
|
module Cucumber
|
4
4
|
module Core
|
5
5
|
module Test
|
6
|
+
|
7
|
+
# Sorts and filters scenarios based on a list of locations
|
6
8
|
class LocationsFilter < Filter.new(:locations)
|
7
9
|
|
8
10
|
def test_case(test_case)
|
9
|
-
|
10
|
-
|
11
|
+
test_cases << test_case
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def done
|
16
|
+
sorted_test_cases.each do |test_case|
|
17
|
+
test_case.describe_to receiver
|
11
18
|
end
|
19
|
+
receiver.done
|
12
20
|
self
|
13
21
|
end
|
14
22
|
|
23
|
+
private
|
24
|
+
|
25
|
+
def sorted_test_cases
|
26
|
+
locations.map { |location| test_cases_matching(location) }.flatten
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_cases_matching(location)
|
30
|
+
test_cases.select do |test_case|
|
31
|
+
test_case.match_locations?([location])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_cases
|
36
|
+
@test_cases ||= []
|
37
|
+
end
|
38
|
+
|
15
39
|
end
|
16
40
|
end
|
17
41
|
end
|
@@ -45,8 +45,8 @@ module Cucumber
|
|
45
45
|
expect( doc_string ).to eq 'foo'
|
46
46
|
end
|
47
47
|
|
48
|
-
it '
|
49
|
-
expect
|
48
|
+
it 'returns false when compared with something odd' do
|
49
|
+
expect( doc_string ).not_to eq 5
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'cucumber/core/gherkin/writer'
|
2
|
+
require 'cucumber/core'
|
3
|
+
require 'cucumber/core/test/filters/locations_filter'
|
4
|
+
|
5
|
+
module Cucumber::Core::Test
|
6
|
+
describe LocationsFilter do
|
7
|
+
include Cucumber::Core::Gherkin::Writer
|
8
|
+
include Cucumber::Core
|
9
|
+
|
10
|
+
let(:receiver) { SpyReceiver.new }
|
11
|
+
|
12
|
+
let(:doc) do
|
13
|
+
gherkin do
|
14
|
+
feature do
|
15
|
+
scenario 'x' do
|
16
|
+
step 'a step'
|
17
|
+
end
|
18
|
+
|
19
|
+
scenario 'y' do
|
20
|
+
step 'a step'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "sorts by the given locations" do
|
27
|
+
locations = [
|
28
|
+
Cucumber::Core::Ast::Location.new('features/test.feature', 6),
|
29
|
+
Cucumber::Core::Ast::Location.new('features/test.feature', 3)
|
30
|
+
]
|
31
|
+
filter = LocationsFilter.new(locations)
|
32
|
+
compile [doc], receiver, [filter]
|
33
|
+
expect(receiver.test_case_locations).to eq ["features/test.feature:6", "features/test.feature:3"]
|
34
|
+
end
|
35
|
+
|
36
|
+
it "works with wildcard locations" do
|
37
|
+
locations = [
|
38
|
+
Cucumber::Core::Ast::Location.new('features/test.feature')
|
39
|
+
]
|
40
|
+
filter = LocationsFilter.new(locations)
|
41
|
+
compile [doc], receiver, [filter]
|
42
|
+
expect(receiver.test_case_locations).to eq ["features/test.feature:3", "features/test.feature:6"]
|
43
|
+
end
|
44
|
+
|
45
|
+
it "filters out scenarios that don't match" do
|
46
|
+
locations = [
|
47
|
+
Cucumber::Core::Ast::Location.new('features/test.feature', 3)
|
48
|
+
]
|
49
|
+
filter = LocationsFilter.new(locations)
|
50
|
+
compile [doc], receiver, [filter]
|
51
|
+
expect(receiver.test_case_locations).to eq ["features/test.feature:3"]
|
52
|
+
end
|
53
|
+
|
54
|
+
class SpyReceiver
|
55
|
+
def test_case(test_case)
|
56
|
+
test_cases << test_case
|
57
|
+
end
|
58
|
+
|
59
|
+
def done
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_case_locations
|
63
|
+
test_cases.map(&:location).map(&:to_s)
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def test_cases
|
69
|
+
@test_cases ||= []
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/spec/cucumber/core_spec.rb
CHANGED
@@ -334,31 +334,6 @@ module Cucumber
|
|
334
334
|
expect( report.test_cases.total ).to eq 1
|
335
335
|
end
|
336
336
|
|
337
|
-
it "filters test cases by filename" do
|
338
|
-
documents = []
|
339
|
-
documents << gherkin("some.feature") do
|
340
|
-
feature 'some feature' do
|
341
|
-
scenario 'some scenario' do
|
342
|
-
step 'missing'
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
346
|
-
documents << gherkin("other.feature") do
|
347
|
-
feature 'other feature' do
|
348
|
-
scenario 'other scenario' do
|
349
|
-
step 'missing'
|
350
|
-
end
|
351
|
-
end
|
352
|
-
end
|
353
|
-
|
354
|
-
report = Core::Report::Summary.new
|
355
|
-
some_feature = Cucumber::Core::Ast::Location.new("some.feature")
|
356
|
-
filters = [ Cucumber::Core::Test::LocationsFilter.new([some_feature]) ]
|
357
|
-
|
358
|
-
execute documents, report, filters
|
359
|
-
|
360
|
-
expect( report.test_cases.total ).to eq 1
|
361
|
-
end
|
362
337
|
end
|
363
338
|
end
|
364
339
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-02-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: gherkin
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- spec/cucumber/core/test/action_spec.rb
|
185
185
|
- spec/cucumber/core/test/case_spec.rb
|
186
186
|
- spec/cucumber/core/test/duration_matcher.rb
|
187
|
+
- spec/cucumber/core/test/filters/locations_filter_spec.rb
|
187
188
|
- spec/cucumber/core/test/result_spec.rb
|
188
189
|
- spec/cucumber/core/test/runner_spec.rb
|
189
190
|
- spec/cucumber/core/test/step_spec.rb
|
@@ -212,10 +213,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
213
|
version: '0'
|
213
214
|
requirements: []
|
214
215
|
rubyforge_project:
|
215
|
-
rubygems_version: 2.
|
216
|
+
rubygems_version: 2.4.5
|
216
217
|
signing_key:
|
217
218
|
specification_version: 4
|
218
|
-
summary: cucumber-core-1.
|
219
|
+
summary: cucumber-core-1.1.0
|
219
220
|
test_files:
|
220
221
|
- spec/capture_warnings.rb
|
221
222
|
- spec/coverage.rb
|
@@ -232,6 +233,7 @@ test_files:
|
|
232
233
|
- spec/cucumber/core/test/action_spec.rb
|
233
234
|
- spec/cucumber/core/test/case_spec.rb
|
234
235
|
- spec/cucumber/core/test/duration_matcher.rb
|
236
|
+
- spec/cucumber/core/test/filters/locations_filter_spec.rb
|
235
237
|
- spec/cucumber/core/test/result_spec.rb
|
236
238
|
- spec/cucumber/core/test/runner_spec.rb
|
237
239
|
- spec/cucumber/core/test/step_spec.rb
|
@@ -239,3 +241,4 @@ test_files:
|
|
239
241
|
- spec/cucumber/core_spec.rb
|
240
242
|
- spec/readme_spec.rb
|
241
243
|
- spec/report_api_spy.rb
|
244
|
+
has_rdoc:
|