cql 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cql.rb +86 -34
- data/lib/cql/dsl.rb +152 -0
- data/lib/cql/feature_filters.rb +14 -0
- data/lib/cql/filters.rb +74 -0
- data/lib/cql/map_reduce.rb +48 -0
- data/lib/cql/sso_filters.rb +26 -0
- data/lib/cql/version.rb +3 -0
- data/spec/dsl_spec.rb +51 -0
- data/spec/filter_example_spec.rb +65 -0
- data/spec/filter_feature_dsl_spec.rb +13 -12
- data/spec/filter_sso_spec.rb +54 -14
- data/spec/line_count_filterable_specs.rb +4 -4
- data/spec/map_reduce_spec.rb +13 -11
- data/spec/multiple_queries_spec.rb +5 -9
- data/spec/name_filterable_specs.rb +1 -1
- data/spec/repository_spec.rb +17 -0
- data/spec/select_feature_dsl_spec.rb +28 -106
- data/spec/select_scen_outline_dsl_spec.rb +75 -166
- data/spec/select_scenario_dsl_spec.rb +37 -72
- data/spec/spec_helper.rb +4 -1
- data/spec/tag_filterable_specs.rb +5 -5
- metadata +79 -12
- checksums.yaml +0 -15
- data/lib/dsl.rb +0 -111
- data/lib/feature_filters.rb +0 -89
- data/lib/map_reduce.rb +0 -104
- data/lib/sso_filters.rb +0 -82
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'cql/filters'
|
2
|
+
|
3
|
+
|
4
|
+
module CQL
|
5
|
+
|
6
|
+
class SsoLineCountFilter < TypeCountFilter
|
7
|
+
|
8
|
+
def type_count(test)
|
9
|
+
test.steps.size
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
class LineFilter < ContentMatchFilter
|
15
|
+
|
16
|
+
def execute(input)
|
17
|
+
input.find_all do |tests|
|
18
|
+
raw_step_lines = tests.steps.map { |step| step.base }
|
19
|
+
|
20
|
+
content_match?(raw_step_lines)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/lib/cql/version.rb
ADDED
data/spec/dsl_spec.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'dsl' do
|
4
|
+
describe "select" do
|
5
|
+
|
6
|
+
describe "multiple selections" do
|
7
|
+
|
8
|
+
it 'should handle an empty selection' do
|
9
|
+
skip("It may be useful to be able to return both the underlying object and various attributes on it (which is the probably the intent of this query [assuming that it's not just a typo]) but I can't think of a clean way to do it. Behavior undefined for now.")
|
10
|
+
|
11
|
+
gs = CQL::Repository.new("#{@feature_fixtures_directory}/scenario/simple")
|
12
|
+
|
13
|
+
result = gs.query do
|
14
|
+
select
|
15
|
+
select name
|
16
|
+
from features
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "from" do
|
25
|
+
|
26
|
+
describe "multiple targets" do
|
27
|
+
|
28
|
+
it 'raises an exception for inapplicable attributes' do
|
29
|
+
gs = CQL::Repository.new("#{@feature_fixtures_directory}/scenario/simple")
|
30
|
+
|
31
|
+
expect {
|
32
|
+
gs.query do
|
33
|
+
select name, steps
|
34
|
+
from features
|
35
|
+
from scenarios
|
36
|
+
end
|
37
|
+
}.to raise_error
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'shorthand' do
|
45
|
+
|
46
|
+
it 'should consider an exact match over a pluralization' do
|
47
|
+
skip('Not sure how to test this without actually have two classes that are so similarly named. It is a required behavior, but not one worth the hassle of testing until it actually comes up.')
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
describe "example filters (with)" do
|
5
|
+
|
6
|
+
|
7
|
+
it_behaves_like 'a name filterable target set', 'examples', {:exact_name => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/examples/name_filter",
|
8
|
+
:expected_results => {'name1' => [{"name" => "name1"}]}},
|
9
|
+
:regexp => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/examples/name_filter",
|
10
|
+
:expected_results => {/name/ => [{"name" => "name1"}, {"name" => "name2"}, {"name" => "name3"}],
|
11
|
+
/name1/ => [{"name" => "name1"}]}}
|
12
|
+
}
|
13
|
+
|
14
|
+
it_behaves_like 'a tag filterable target set', 'examples', {:single_tag => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/examples/filters/tags",
|
15
|
+
:expected_results => {'@one' => [{'name' => 'Next'}, {'name' => 'Another'}]}},
|
16
|
+
|
17
|
+
:multiple_tags => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/examples/filters/tags2",
|
18
|
+
:expected_results => {['@one', '@five'] => [{'name' => 'Next'}]}},
|
19
|
+
|
20
|
+
:tc_lt => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/examples/filters/tag_count",
|
21
|
+
:expected_results => {0 => [],
|
22
|
+
1 => [],
|
23
|
+
2 => [{"name" => "1 tag"}],
|
24
|
+
3 => [{"name" => "1 tag"}, {"name" => "2 tags"}],
|
25
|
+
4 => [{"name" => "1 tag"}, {"name" => "2 tags"}, {"name" => "3 tags"}],
|
26
|
+
5 => [{"name" => "1 tag"}, {"name" => "2 tags"}, {"name" => "3 tags"}, {"name" => "4 tags"}]}},
|
27
|
+
|
28
|
+
:tc_lte => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/examples/filters/tag_count",
|
29
|
+
:expected_results => {0 => [],
|
30
|
+
1 => [{"name" => "1 tag"}],
|
31
|
+
2 => [{"name" => "1 tag"}, {"name" => "2 tags"}],
|
32
|
+
3 => [{"name" => "1 tag"}, {"name" => "2 tags"}, {"name" => "3 tags"}],
|
33
|
+
4 => [{"name" => "1 tag"}, {"name" => "2 tags"}, {"name" => "3 tags"}, {"name" => "4 tags"}],
|
34
|
+
5 => [{"name" => "1 tag"}, {"name" => "2 tags"}, {"name" => "3 tags"}, {"name" => "4 tags"}]}},
|
35
|
+
|
36
|
+
:tc_gt => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/examples/filters/tag_count",
|
37
|
+
:expected_results => {0 => [{"name" => "1 tag"}, {"name" => "2 tags"}, {"name" => "3 tags"}, {"name" => "4 tags"}],
|
38
|
+
1 => [{"name" => "2 tags"}, {"name" => "3 tags"}, {"name" => "4 tags"}],
|
39
|
+
2 => [{"name" => "3 tags"}, {"name" => "4 tags"}],
|
40
|
+
3 => [{"name" => "4 tags"}],
|
41
|
+
4 => []}},
|
42
|
+
|
43
|
+
:tc_gte => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/examples/filters/tag_count",
|
44
|
+
:expected_results => {0 => [{"name" => "1 tag"}, {"name" => "2 tags"}, {"name" => "3 tags"}, {"name" => "4 tags"}],
|
45
|
+
1 => [{"name" => "1 tag"}, {"name" => "2 tags"}, {"name" => "3 tags"}, {"name" => "4 tags"}],
|
46
|
+
2 => [{"name" => "2 tags"}, {"name" => "3 tags"}, {"name" => "4 tags"}],
|
47
|
+
3 => [{"name" => "3 tags"}, {"name" => "4 tags"}],
|
48
|
+
4 => [{"name" => "4 tags"}],
|
49
|
+
5 => []}}
|
50
|
+
}
|
51
|
+
|
52
|
+
it 'should filter by multiple filters' do
|
53
|
+
gs = CQL::Repository.new("#{@feature_fixtures_directory}/examples/filters/tag_count")
|
54
|
+
|
55
|
+
result = gs.query do
|
56
|
+
select name
|
57
|
+
from examples
|
58
|
+
with tc gt 1
|
59
|
+
with tc lt 3
|
60
|
+
end
|
61
|
+
|
62
|
+
expect(result).to eq([{"name" => "2 tags"}])
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "feature filters (with)" do
|
4
4
|
describe 'scenario outline and scenario count functions (ssoc)' do
|
5
|
+
|
5
6
|
it 'should filter based on ssoc_gt' do
|
6
7
|
gs = CQL::Repository.new("#{@feature_fixtures_directory}/combined/a")
|
7
8
|
|
@@ -14,7 +15,7 @@ describe "feature filters (with)" do
|
|
14
15
|
with ssoc gt number
|
15
16
|
end
|
16
17
|
|
17
|
-
expect(result).to
|
18
|
+
expect(result).to match_array(expected)
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
@@ -33,7 +34,7 @@ describe "feature filters (with)" do
|
|
33
34
|
with ssoc gte number
|
34
35
|
end
|
35
36
|
|
36
|
-
expect(result).to
|
37
|
+
expect(result).to match_array(expected)
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
@@ -51,7 +52,7 @@ describe "feature filters (with)" do
|
|
51
52
|
with ssoc lt number
|
52
53
|
end
|
53
54
|
|
54
|
-
expect(result).to
|
55
|
+
expect(result).to match_array(expected)
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
@@ -70,7 +71,7 @@ describe "feature filters (with)" do
|
|
70
71
|
with ssoc lte number
|
71
72
|
end
|
72
73
|
|
73
|
-
expect(result).to
|
74
|
+
expect(result).to match_array(expected)
|
74
75
|
end
|
75
76
|
end
|
76
77
|
|
@@ -90,7 +91,7 @@ describe "feature filters (with)" do
|
|
90
91
|
with sc gt number
|
91
92
|
end
|
92
93
|
|
93
|
-
expect(result).to
|
94
|
+
expect(result).to match_array(expected)
|
94
95
|
end
|
95
96
|
end
|
96
97
|
|
@@ -109,7 +110,7 @@ describe "feature filters (with)" do
|
|
109
110
|
with sc gte number
|
110
111
|
end
|
111
112
|
|
112
|
-
expect(result).to
|
113
|
+
expect(result).to match_array(expected)
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
@@ -128,7 +129,7 @@ describe "feature filters (with)" do
|
|
128
129
|
with sc lt number
|
129
130
|
end
|
130
131
|
|
131
|
-
expect(result).to
|
132
|
+
expect(result).to match_array(expected)
|
132
133
|
end
|
133
134
|
end
|
134
135
|
|
@@ -146,7 +147,7 @@ describe "feature filters (with)" do
|
|
146
147
|
with sc lte number
|
147
148
|
end
|
148
149
|
|
149
|
-
expect(result).to
|
150
|
+
expect(result).to match_array(expected)
|
150
151
|
end
|
151
152
|
end
|
152
153
|
end
|
@@ -198,7 +199,7 @@ describe "feature filters (with)" do
|
|
198
199
|
with soc gt number
|
199
200
|
end
|
200
201
|
|
201
|
-
expect(result).to
|
202
|
+
expect(result).to match_array(expected)
|
202
203
|
end
|
203
204
|
end
|
204
205
|
|
@@ -217,7 +218,7 @@ describe "feature filters (with)" do
|
|
217
218
|
with soc gte number
|
218
219
|
end
|
219
220
|
|
220
|
-
expect(result).to
|
221
|
+
expect(result).to match_array(expected)
|
221
222
|
end
|
222
223
|
end
|
223
224
|
|
@@ -236,7 +237,7 @@ describe "feature filters (with)" do
|
|
236
237
|
with soc lt number
|
237
238
|
end
|
238
239
|
|
239
|
-
expect(result).to
|
240
|
+
expect(result).to match_array(expected)
|
240
241
|
end
|
241
242
|
end
|
242
243
|
|
@@ -255,7 +256,7 @@ describe "feature filters (with)" do
|
|
255
256
|
with soc lte number
|
256
257
|
end
|
257
258
|
|
258
|
-
expect(result).to
|
259
|
+
expect(result).to match_array(expected)
|
259
260
|
end
|
260
261
|
end
|
261
262
|
end
|
data/spec/filter_sso_spec.rb
CHANGED
@@ -3,13 +3,12 @@ require 'spec_helper'
|
|
3
3
|
describe "scenario and outline filters (with)" do
|
4
4
|
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
#}
|
6
|
+
it_behaves_like 'a name filterable target set', 'scenarios', {:exact_name => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scenario/name_filter",
|
7
|
+
:expected_results => {'name1' => [{"name" => "name1"}]}},
|
8
|
+
:regexp => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scenario/name_filter",
|
9
|
+
:expected_results => {/name/ => [{"name" => "name1"}, {"name" => "name2"}, {"name" => "name3"}],
|
10
|
+
/name1/ => [{"name" => "name1"}]}}
|
11
|
+
}
|
13
12
|
|
14
13
|
it_behaves_like 'a tag filterable target set', 'scenarios', {:single_tag => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scenario/tags",
|
15
14
|
:expected_results => {'@one' => [{'name' => 'Next'}, {'name' => 'Another'}]}},
|
@@ -49,7 +48,7 @@ describe "scenario and outline filters (with)" do
|
|
49
48
|
5 => []}}
|
50
49
|
}
|
51
50
|
|
52
|
-
it_behaves_like 'a tag filterable target set', '
|
51
|
+
it_behaves_like 'a tag filterable target set', 'outlines', {:single_tag => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/filters/tags",
|
53
52
|
:expected_results => {'@one' => [{'name' => 'Next'}, {'name' => 'Another'}]}},
|
54
53
|
|
55
54
|
:multiple_tags => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/filters/tags2",
|
@@ -143,7 +142,7 @@ describe "scenario and outline filters (with)" do
|
|
143
142
|
|
144
143
|
result = gs.query do
|
145
144
|
select name
|
146
|
-
from
|
145
|
+
from outlines
|
147
146
|
with tc gt 1
|
148
147
|
with tc lt 3
|
149
148
|
end
|
@@ -151,11 +150,52 @@ describe "scenario and outline filters (with)" do
|
|
151
150
|
expect(result).to eq([{"name" => "2 tags"}])
|
152
151
|
end
|
153
152
|
|
154
|
-
#todo - add line filter tests for scenario outlines
|
155
|
-
#todo - add line count filter tests for scenario outlines
|
156
153
|
|
157
|
-
#
|
158
|
-
|
159
|
-
|
154
|
+
it_behaves_like 'a line count filterable target set', 'outlines', {:lc_lt => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/line_count",
|
155
|
+
:expected_results => {0 => [],
|
156
|
+
1 => [],
|
157
|
+
2 => [{"name" => "1 line"}],
|
158
|
+
3 => [{"name" => "1 line"}, {"name" => "2 lines"}],
|
159
|
+
4 => [{"name" => "1 line"}, {"name" => "2 lines"}, {"name" => "3 lines"}],
|
160
|
+
5 => [{"name" => "1 line"}, {"name" => "2 lines"}, {"name" => "3 lines"}, {"name" => "4 lines"}]}},
|
161
|
+
:lc_lte => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/line_count",
|
162
|
+
:expected_results => {0 => [],
|
163
|
+
1 => [{"name" => "1 line"}],
|
164
|
+
2 => [{"name" => "1 line"}, {"name" => "2 lines"}],
|
165
|
+
3 => [{"name" => "1 line"}, {"name" => "2 lines"}, {"name" => "3 lines"}],
|
166
|
+
4 => [{"name" => "1 line"}, {"name" => "2 lines"}, {"name" => "3 lines"}, {"name" => "4 lines"}],
|
167
|
+
5 => [{"name" => "1 line"}, {"name" => "2 lines"}, {"name" => "3 lines"}, {"name" => "4 lines"}]}},
|
168
|
+
:lc_gt => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/line_count",
|
169
|
+
:expected_results => {0 => [{"name" => "1 line"}, {"name" => "2 lines"}, {"name" => "3 lines"}, {"name" => "4 lines"}],
|
170
|
+
1 => [{"name" => "2 lines"}, {"name" => "3 lines"}, {"name" => "4 lines"}],
|
171
|
+
2 => [{"name" => "3 lines"}, {"name" => "4 lines"}],
|
172
|
+
3 => [{"name" => "4 lines"}],
|
173
|
+
4 => []}},
|
174
|
+
:lc_gte => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/line_count",
|
175
|
+
:expected_results => {0 => [{"name" => "1 line"}, {"name" => "2 lines"}, {"name" => "3 lines"}, {"name" => "4 lines"}],
|
176
|
+
1 => [{"name" => "1 line"}, {"name" => "2 lines"}, {"name" => "3 lines"}, {"name" => "4 lines"}],
|
177
|
+
2 => [{"name" => "2 lines"}, {"name" => "3 lines"}, {"name" => "4 lines"}],
|
178
|
+
3 => [{"name" => "3 lines"}, {"name" => "4 lines"}],
|
179
|
+
4 => [{"name" => "4 lines"}],
|
180
|
+
5 => []}}}
|
181
|
+
|
182
|
+
|
183
|
+
it_behaves_like 'a line filterable target set', 'outlines', {:exact_line => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/line_filter",
|
184
|
+
:expected_results => {'all match' => [{"name" => "sc1"}, {"name" => "sc2"}],
|
185
|
+
'green eggs and ham' => [{"name" => "sc1"}],
|
186
|
+
'no match' => []}},
|
187
|
+
:regexp => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/line_filter",
|
188
|
+
:expected_results => {/all/ => [{"name" => "sc1"}, {"name" => "sc2"}],
|
189
|
+
/green/ => [{"name" => "sc1"}],
|
190
|
+
/will not be found/ => []}}}
|
191
|
+
|
192
|
+
|
193
|
+
it_behaves_like 'a name filterable target set', 'outlines', {:exact_name => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/name_filter",
|
194
|
+
:expected_results => {'name1' => [{"name" => "name1"}]}},
|
195
|
+
:regexp => {:fixture_location => "#{CQL_FEATURE_FIXTURES_DIRECTORY}/scen_outlines/name_filter",
|
196
|
+
:expected_results => {/name/ => [{"name" => "name1"}, {"name" => "name2"}, {"name" => "name3"}],
|
197
|
+
/name1/ => [{"name" => "name1"}]}}
|
198
|
+
}
|
199
|
+
|
160
200
|
# # Example count
|
161
201
|
end
|
@@ -17,7 +17,7 @@ shared_examples_for 'a line count filterable target set' do |target_type, test_d
|
|
17
17
|
with lc lt number
|
18
18
|
end
|
19
19
|
|
20
|
-
expect(result).to
|
20
|
+
expect(result).to match_array(expected)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -33,7 +33,7 @@ shared_examples_for 'a line count filterable target set' do |target_type, test_d
|
|
33
33
|
with lc lte number
|
34
34
|
end
|
35
35
|
|
36
|
-
expect(result).to
|
36
|
+
expect(result).to match_array(expected)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -49,7 +49,7 @@ shared_examples_for 'a line count filterable target set' do |target_type, test_d
|
|
49
49
|
with lc gt number
|
50
50
|
end
|
51
51
|
|
52
|
-
expect(result).to
|
52
|
+
expect(result).to match_array(expected)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -65,7 +65,7 @@ shared_examples_for 'a line count filterable target set' do |target_type, test_d
|
|
65
65
|
with lc gte number
|
66
66
|
end
|
67
67
|
|
68
|
-
expect(result).to
|
68
|
+
expect(result).to match_array(expected)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
data/spec/map_reduce_spec.rb
CHANGED
@@ -2,17 +2,19 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "cql" do
|
4
4
|
|
5
|
-
describe "file parsing" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
# describe "file parsing" do
|
6
|
+
# it 'should find the physical files' do
|
7
|
+
# skip("This is possibly no longer be needed")
|
8
|
+
#
|
9
|
+
# gs = CQL::Repository.new("#{@feature_fixtures_directory}/scenario/simple")
|
10
|
+
# result = CQL::MapReduce.uri(gs.parsed_feature_files)
|
11
|
+
#
|
12
|
+
# expect(result[0]).to match(/simple\.feature/)
|
13
|
+
# expect(result[1]).to match(/test\.feature/)
|
14
|
+
# expect(result[2]).to match(/test2\.feature/)
|
15
|
+
# expect(result[3]).to match(/test_full\.feature/)
|
16
|
+
# end
|
17
|
+
# end
|
16
18
|
|
17
19
|
#it 'should filter by count functions' do
|
18
20
|
# input = [{"keyword"=>"Feature", "name"=>"f1_4_scenarios_5_so", "line"=>1, "description"=>"", "id"=>"f1-4-scenarios-5-so", "uri"=>"C:/Users/jarrod/dev/gql/spec/../fixtures/features/combined/a/f1_4_scenarios_5_so.feature", "elements"=>[{"keyword"=>"Scenario", "name"=>"f1_scen1", "line"=>3, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-scen1", "type"=>"scenario", "steps"=>[{"keyword"=>"Given ", "name"=>"Something", "line"=>4}, {"keyword"=>"Then ", "name"=>"something else", "line"=>5}]}, {"keyword"=>"Scenario", "name"=>"f1_scen2", "line"=>7, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-scen2", "type"=>"scenario", "steps"=>[{"keyword"=>"Given ", "name"=>"Something", "line"=>8}, {"keyword"=>"Then ", "name"=>"something else", "line"=>9}]}, {"keyword"=>"Scenario", "name"=>"f1_scen3", "line"=>11, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-scen3", "type"=>"scenario", "steps"=>[{"keyword"=>"Given ", "name"=>"Something", "line"=>12}, {"keyword"=>"Then ", "name"=>"something else", "line"=>13}]}, {"keyword"=>"Scenario", "name"=>"f1_scen4", "line"=>15, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-scen4", "type"=>"scenario", "steps"=>[{"keyword"=>"Given ", "name"=>"Something", "line"=>16}, {"keyword"=>"Then ", "name"=>"something else", "line"=>17}]}, {"keyword"=>"Scenario Outline", "name"=>"f1_so1", "line"=>19, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so1", "type"=>"scenario_outline", "steps"=>[{"keyword"=>"Given ", "name"=>"blah <e>", "line"=>20}], "examples"=>[{"keyword"=>"Examples", "name"=>"", "line"=>22, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so1;", "rows"=>[{"cells"=>["e"], "line"=>23, "id"=>"f1-4-scenarios-5-so;f1-so1;;1"}, {"cells"=>["r"], "line"=>24, "id"=>"f1-4-scenarios-5-so;f1-so1;;2"}]}]}, {"keyword"=>"Scenario Outline", "name"=>"f1_so2", "line"=>26, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so2", "type"=>"scenario_outline", "steps"=>[{"keyword"=>"Given ", "name"=>"blah <e>", "line"=>27}], "examples"=>[{"keyword"=>"Examples", "name"=>"", "line"=>29, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so2;", "rows"=>[{"cells"=>["e"], "line"=>30, "id"=>"f1-4-scenarios-5-so;f1-so2;;1"}, {"cells"=>["r"], "line"=>31, "id"=>"f1-4-scenarios-5-so;f1-so2;;2"}]}]}, {"keyword"=>"Scenario Outline", "name"=>"f1_so3", "line"=>33, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so3", "type"=>"scenario_outline", "steps"=>[{"keyword"=>"Given ", "name"=>"blah <e>", "line"=>34}], "examples"=>[{"keyword"=>"Examples", "name"=>"", "line"=>36, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so3;", "rows"=>[{"cells"=>["e"], "line"=>37, "id"=>"f1-4-scenarios-5-so;f1-so3;;1"}, {"cells"=>["r"], "line"=>38, "id"=>"f1-4-scenarios-5-so;f1-so3;;2"}]}]}, {"keyword"=>"Scenario Outline", "name"=>"f1_so4", "line"=>40, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so4", "type"=>"scenario_outline", "steps"=>[{"keyword"=>"Given ", "name"=>"blah <e>", "line"=>41}], "examples"=>[{"keyword"=>"Examples", "name"=>"", "line"=>43, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so4;", "rows"=>[{"cells"=>["e"], "line"=>44, "id"=>"f1-4-scenarios-5-so;f1-so4;;1"}, {"cells"=>["r"], "line"=>45, "id"=>"f1-4-scenarios-5-so;f1-so4;;2"}]}]}, {"keyword"=>"Scenario Outline", "name"=>"f1_so5", "line"=>47, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so5", "type"=>"scenario_outline", "steps"=>[{"keyword"=>"Given ", "name"=>"blah <e>", "line"=>48}], "examples"=>[{"keyword"=>"Examples", "name"=>"", "line"=>50, "description"=>"", "id"=>"f1-4-scenarios-5-so;f1-so5;", "rows"=>[{"cells"=>["e"], "line"=>51, "id"=>"f1-4-scenarios-5-so;f1-so5;;1"}, {"cells"=>["r"], "line"=>52, "id"=>"f1-4-scenarios-5-so;f1-so5;;2"}]}]}]},
|
@@ -7,21 +7,17 @@ describe "cql" do
|
|
7
7
|
|
8
8
|
repo = CQL::Repository.new("#{@feature_fixtures_directory}/got")
|
9
9
|
|
10
|
-
|
10
|
+
before_dump = Marshal.dump(repo)
|
11
|
+
|
12
|
+
repo.query do
|
11
13
|
select name
|
12
14
|
from scenarios
|
13
|
-
with tags '@Lannister'
|
14
15
|
end
|
15
16
|
|
17
|
+
after_dump = Marshal.dump(repo)
|
16
18
|
|
17
|
-
result = repo.query do
|
18
|
-
select name
|
19
|
-
from scenarios
|
20
|
-
with line /child/
|
21
|
-
end
|
22
19
|
|
23
|
-
expect(
|
24
|
-
{"name" => "Bastard Child"}])
|
20
|
+
expect(before_dump).to eq(after_dump)
|
25
21
|
end
|
26
22
|
end
|
27
23
|
end
|