cql 0.1.9 → 0.2
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.
- data/lib/cql.rb +62 -62
- data/lib/dsl.rb +110 -110
- data/lib/feature_filters.rb +72 -72
- data/lib/map_reduce.rb +39 -39
- data/lib/sso_filters.rb +72 -72
- data/spec/filter_feature_dsl_spec.rb +485 -485
- data/spec/filter_sso_spec.rb +287 -287
- data/spec/map_reduce_spec.rb +131 -131
- data/spec/select_feature_dsl_spec.rb +49 -49
- data/spec/select_scen_outline_dsl_spec.rb +125 -125
- data/spec/select_scenario_dsl_spec.rb +72 -72
- data/spec/unit_spec.rb +21 -21
- metadata +3 -3
data/spec/filter_sso_spec.rb
CHANGED
@@ -1,288 +1,288 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require File.dirname(__FILE__) + "/../lib/cql"
|
3
|
-
|
4
|
-
describe "cql" do
|
5
|
-
describe 'tag count' do
|
6
|
-
{
|
7
|
-
0=>[],
|
8
|
-
1=>[],
|
9
|
-
2=>{"name"=> "1 tag"},
|
10
|
-
3=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}],
|
11
|
-
4=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}],
|
12
|
-
5=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}]
|
13
|
-
}.each do |number, expected|
|
14
|
-
it "should filter scenarios by the number of tags with the 'tc lt' operator for count of #{number}" do
|
15
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tag_count"
|
16
|
-
|
17
|
-
result = gs.query do
|
18
|
-
select name
|
19
|
-
from scenarios
|
20
|
-
with tc lt number
|
21
|
-
end
|
22
|
-
|
23
|
-
result.should == expected
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
{
|
28
|
-
0=>[],
|
29
|
-
1=>{"name"=> "1 tag"},
|
30
|
-
2=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}],
|
31
|
-
3=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}],
|
32
|
-
4=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
33
|
-
5=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}]
|
34
|
-
|
35
|
-
}.each do |number, expected|
|
36
|
-
it "should filter scenarios by the number of tags with the 'tc_lte' operator for count of #{number}" do
|
37
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tag_count"
|
38
|
-
|
39
|
-
result = gs.query do
|
40
|
-
select name
|
41
|
-
from scenarios
|
42
|
-
with tc lte number
|
43
|
-
end
|
44
|
-
|
45
|
-
result.should == expected
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
{
|
50
|
-
0=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
51
|
-
1=>[{"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
52
|
-
2=>[{"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
53
|
-
3=>{"name"=> "4 tags"},
|
54
|
-
4=>[]
|
55
|
-
}.each do |number, expected|
|
56
|
-
it "should filter scenarios by the number of tags with the 'tc_gt' operator for count of #{number}" do
|
57
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tag_count"
|
58
|
-
|
59
|
-
result = gs.query do
|
60
|
-
select name
|
61
|
-
from scenarios
|
62
|
-
with tc gt number
|
63
|
-
end
|
64
|
-
|
65
|
-
result.should == expected
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
{
|
70
|
-
0=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
71
|
-
1=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
72
|
-
2=>[{"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
73
|
-
3=>[{"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
74
|
-
4=>{"name"=> "4 tags"},
|
75
|
-
5 =>[]
|
76
|
-
}.each do |number, expected|
|
77
|
-
it "should filter scenarios by the number of tags with the 'tc_gte' operator for count of #{number}" do
|
78
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tag_count"
|
79
|
-
|
80
|
-
result = gs.query do
|
81
|
-
select name
|
82
|
-
from scenarios
|
83
|
-
with tc gte number
|
84
|
-
end
|
85
|
-
|
86
|
-
result.should == expected
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
describe 'line count' do
|
94
|
-
{
|
95
|
-
0=>[],
|
96
|
-
1=>[],
|
97
|
-
2=>{"name"=> "1 line"},
|
98
|
-
3=>[{"name"=> "1 line"}, {"name"=> "2 lines"}],
|
99
|
-
4=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}],
|
100
|
-
5=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}]
|
101
|
-
|
102
|
-
}.each do |number, expected|
|
103
|
-
it "should filter scenarios by the number of lines with the 'lc_lt' operator for count of #{number}" do
|
104
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_count"
|
105
|
-
|
106
|
-
result = gs.query do
|
107
|
-
select name
|
108
|
-
from scenarios
|
109
|
-
with lc lt number
|
110
|
-
end
|
111
|
-
|
112
|
-
result.should == expected
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
{
|
117
|
-
0=>[],
|
118
|
-
1=>{"name"=> "1 line"},
|
119
|
-
2=>[{"name"=> "1 line"}, {"name"=> "2 lines"}],
|
120
|
-
3=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}],
|
121
|
-
4=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
122
|
-
5=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}]
|
123
|
-
|
124
|
-
}.each do |number, expected|
|
125
|
-
it "should filter scenarios by the number of lines with the 'lc_lte' operator for count of #{number}" do
|
126
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_count"
|
127
|
-
|
128
|
-
result = gs.query do
|
129
|
-
select name
|
130
|
-
from scenarios
|
131
|
-
with lc lte number
|
132
|
-
end
|
133
|
-
|
134
|
-
result.should == expected
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
{
|
139
|
-
0=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
140
|
-
1=>[{"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
141
|
-
2=>[{"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
142
|
-
3=>{"name"=> "4 lines"},
|
143
|
-
4=>[]
|
144
|
-
|
145
|
-
|
146
|
-
}.each do |number, expected|
|
147
|
-
it "should filter scenarios by the number of lines with the 'lc_gt' operator for count of #{number}" do
|
148
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_count"
|
149
|
-
|
150
|
-
result = gs.query do
|
151
|
-
select name
|
152
|
-
from scenarios
|
153
|
-
with lc gt number
|
154
|
-
end
|
155
|
-
|
156
|
-
result.should == expected
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
{
|
161
|
-
0=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
162
|
-
1=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
163
|
-
2=>[{"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
164
|
-
3=>[{"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
165
|
-
4=>{"name"=> "4 lines"},
|
166
|
-
5 =>[]
|
167
|
-
|
168
|
-
|
169
|
-
}.each do |number, expected|
|
170
|
-
it "should filter scenarios by the number of lines with the 'lc_gte' operator for count of #{number}" do
|
171
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_count"
|
172
|
-
|
173
|
-
result = gs.query do
|
174
|
-
select name
|
175
|
-
from scenarios
|
176
|
-
with lc gte number
|
177
|
-
end
|
178
|
-
|
179
|
-
result.should == expected
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
|
184
|
-
end
|
185
|
-
|
186
|
-
describe 'exact line match' do
|
187
|
-
it 'should filter based on an exact line' do
|
188
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
189
|
-
|
190
|
-
result = gs.query do
|
191
|
-
select name
|
192
|
-
from scenarios
|
193
|
-
with line 'green eggs and ham'
|
194
|
-
end
|
195
|
-
|
196
|
-
result.size.should == 1
|
197
|
-
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'should filter all results when the exact line given does not match' do
|
201
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
202
|
-
|
203
|
-
result = gs.query do
|
204
|
-
select name
|
205
|
-
from scenarios
|
206
|
-
with line 'no match'
|
207
|
-
end
|
208
|
-
|
209
|
-
result.size.should == 0
|
210
|
-
|
211
|
-
end
|
212
|
-
|
213
|
-
it 'should filter no results when the exact line given is present in all scenarios' do
|
214
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
215
|
-
|
216
|
-
result = gs.query do
|
217
|
-
select name
|
218
|
-
from scenarios
|
219
|
-
with line 'a cat in a hat'
|
220
|
-
end
|
221
|
-
|
222
|
-
result.size.should == 2
|
223
|
-
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
describe 'exact line match' do
|
228
|
-
it 'should filter based on a regexp match' do
|
229
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
230
|
-
|
231
|
-
result = gs.query do
|
232
|
-
select name
|
233
|
-
from scenarios
|
234
|
-
with line /green/
|
235
|
-
end
|
236
|
-
|
237
|
-
result.size.should == 1
|
238
|
-
|
239
|
-
end
|
240
|
-
|
241
|
-
it 'should filter all if no regexp match' do
|
242
|
-
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
243
|
-
|
244
|
-
result = gs.query do
|
245
|
-
select name
|
246
|
-
from scenarios
|
247
|
-
with line /will not be found/
|
248
|
-
end
|
249
|
-
|
250
|
-
result.size.should == 0
|
251
|
-
|
252
|
-
end
|
253
|
-
|
254
|
-
it 'should filter none if all match regexp' do
|
255
|
-
repo = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
256
|
-
|
257
|
-
result = repo.query do
|
258
|
-
select name
|
259
|
-
from scenarios
|
260
|
-
with line /cat/
|
261
|
-
end
|
262
|
-
|
263
|
-
result.size.should == 2
|
264
|
-
|
265
|
-
end
|
266
|
-
|
267
|
-
end
|
268
|
-
|
269
|
-
describe 'tag search' do
|
270
|
-
it 'should return scenarios with matching tags' do
|
271
|
-
repo = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tags"
|
272
|
-
|
273
|
-
result = repo.query do
|
274
|
-
select name
|
275
|
-
from scenarios
|
276
|
-
with tags '@one'
|
277
|
-
end
|
278
|
-
|
279
|
-
result.should == [{'name'=>'Next'},{'name'=>'Another'}]
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
# Has tag
|
284
|
-
# Name
|
285
|
-
# Name match
|
286
|
-
|
287
|
-
# Example count
|
1
|
+
require 'rspec'
|
2
|
+
require File.dirname(__FILE__) + "/../lib/cql"
|
3
|
+
|
4
|
+
describe "cql" do
|
5
|
+
describe 'tag count' do
|
6
|
+
{
|
7
|
+
0=>[],
|
8
|
+
1=>[],
|
9
|
+
2=>{"name"=> "1 tag"},
|
10
|
+
3=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}],
|
11
|
+
4=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}],
|
12
|
+
5=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}]
|
13
|
+
}.each do |number, expected|
|
14
|
+
it "should filter scenarios by the number of tags with the 'tc lt' operator for count of #{number}" do
|
15
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tag_count"
|
16
|
+
|
17
|
+
result = gs.query do
|
18
|
+
select name
|
19
|
+
from scenarios
|
20
|
+
with tc lt number
|
21
|
+
end
|
22
|
+
|
23
|
+
result.should == expected
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
{
|
28
|
+
0=>[],
|
29
|
+
1=>{"name"=> "1 tag"},
|
30
|
+
2=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}],
|
31
|
+
3=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}],
|
32
|
+
4=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
33
|
+
5=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}]
|
34
|
+
|
35
|
+
}.each do |number, expected|
|
36
|
+
it "should filter scenarios by the number of tags with the 'tc_lte' operator for count of #{number}" do
|
37
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tag_count"
|
38
|
+
|
39
|
+
result = gs.query do
|
40
|
+
select name
|
41
|
+
from scenarios
|
42
|
+
with tc lte number
|
43
|
+
end
|
44
|
+
|
45
|
+
result.should == expected
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
{
|
50
|
+
0=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
51
|
+
1=>[{"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
52
|
+
2=>[{"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
53
|
+
3=>{"name"=> "4 tags"},
|
54
|
+
4=>[]
|
55
|
+
}.each do |number, expected|
|
56
|
+
it "should filter scenarios by the number of tags with the 'tc_gt' operator for count of #{number}" do
|
57
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tag_count"
|
58
|
+
|
59
|
+
result = gs.query do
|
60
|
+
select name
|
61
|
+
from scenarios
|
62
|
+
with tc gt number
|
63
|
+
end
|
64
|
+
|
65
|
+
result.should == expected
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
{
|
70
|
+
0=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
71
|
+
1=>[{"name"=> "1 tag"}, {"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
72
|
+
2=>[{"name"=> "2 tags"}, {"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
73
|
+
3=>[{"name"=> "3 tags"}, {"name"=> "4 tags"}],
|
74
|
+
4=>{"name"=> "4 tags"},
|
75
|
+
5 =>[]
|
76
|
+
}.each do |number, expected|
|
77
|
+
it "should filter scenarios by the number of tags with the 'tc_gte' operator for count of #{number}" do
|
78
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tag_count"
|
79
|
+
|
80
|
+
result = gs.query do
|
81
|
+
select name
|
82
|
+
from scenarios
|
83
|
+
with tc gte number
|
84
|
+
end
|
85
|
+
|
86
|
+
result.should == expected
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
describe 'line count' do
|
94
|
+
{
|
95
|
+
0=>[],
|
96
|
+
1=>[],
|
97
|
+
2=>{"name"=> "1 line"},
|
98
|
+
3=>[{"name"=> "1 line"}, {"name"=> "2 lines"}],
|
99
|
+
4=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}],
|
100
|
+
5=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}]
|
101
|
+
|
102
|
+
}.each do |number, expected|
|
103
|
+
it "should filter scenarios by the number of lines with the 'lc_lt' operator for count of #{number}" do
|
104
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_count"
|
105
|
+
|
106
|
+
result = gs.query do
|
107
|
+
select name
|
108
|
+
from scenarios
|
109
|
+
with lc lt number
|
110
|
+
end
|
111
|
+
|
112
|
+
result.should == expected
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
{
|
117
|
+
0=>[],
|
118
|
+
1=>{"name"=> "1 line"},
|
119
|
+
2=>[{"name"=> "1 line"}, {"name"=> "2 lines"}],
|
120
|
+
3=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}],
|
121
|
+
4=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
122
|
+
5=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}]
|
123
|
+
|
124
|
+
}.each do |number, expected|
|
125
|
+
it "should filter scenarios by the number of lines with the 'lc_lte' operator for count of #{number}" do
|
126
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_count"
|
127
|
+
|
128
|
+
result = gs.query do
|
129
|
+
select name
|
130
|
+
from scenarios
|
131
|
+
with lc lte number
|
132
|
+
end
|
133
|
+
|
134
|
+
result.should == expected
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
{
|
139
|
+
0=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
140
|
+
1=>[{"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
141
|
+
2=>[{"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
142
|
+
3=>{"name"=> "4 lines"},
|
143
|
+
4=>[]
|
144
|
+
|
145
|
+
|
146
|
+
}.each do |number, expected|
|
147
|
+
it "should filter scenarios by the number of lines with the 'lc_gt' operator for count of #{number}" do
|
148
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_count"
|
149
|
+
|
150
|
+
result = gs.query do
|
151
|
+
select name
|
152
|
+
from scenarios
|
153
|
+
with lc gt number
|
154
|
+
end
|
155
|
+
|
156
|
+
result.should == expected
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
{
|
161
|
+
0=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
162
|
+
1=>[{"name"=> "1 line"}, {"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
163
|
+
2=>[{"name"=> "2 lines"}, {"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
164
|
+
3=>[{"name"=> "3 lines"}, {"name"=> "4 lines"}],
|
165
|
+
4=>{"name"=> "4 lines"},
|
166
|
+
5 =>[]
|
167
|
+
|
168
|
+
|
169
|
+
}.each do |number, expected|
|
170
|
+
it "should filter scenarios by the number of lines with the 'lc_gte' operator for count of #{number}" do
|
171
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_count"
|
172
|
+
|
173
|
+
result = gs.query do
|
174
|
+
select name
|
175
|
+
from scenarios
|
176
|
+
with lc gte number
|
177
|
+
end
|
178
|
+
|
179
|
+
result.should == expected
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
describe 'exact line match' do
|
187
|
+
it 'should filter based on an exact line' do
|
188
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
189
|
+
|
190
|
+
result = gs.query do
|
191
|
+
select name
|
192
|
+
from scenarios
|
193
|
+
with line 'green eggs and ham'
|
194
|
+
end
|
195
|
+
|
196
|
+
result.size.should == 1
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
it 'should filter all results when the exact line given does not match' do
|
201
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
202
|
+
|
203
|
+
result = gs.query do
|
204
|
+
select name
|
205
|
+
from scenarios
|
206
|
+
with line 'no match'
|
207
|
+
end
|
208
|
+
|
209
|
+
result.size.should == 0
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'should filter no results when the exact line given is present in all scenarios' do
|
214
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
215
|
+
|
216
|
+
result = gs.query do
|
217
|
+
select name
|
218
|
+
from scenarios
|
219
|
+
with line 'a cat in a hat'
|
220
|
+
end
|
221
|
+
|
222
|
+
result.size.should == 2
|
223
|
+
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
describe 'exact line match' do
|
228
|
+
it 'should filter based on a regexp match' do
|
229
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
230
|
+
|
231
|
+
result = gs.query do
|
232
|
+
select name
|
233
|
+
from scenarios
|
234
|
+
with line /green/
|
235
|
+
end
|
236
|
+
|
237
|
+
result.size.should == 1
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
it 'should filter all if no regexp match' do
|
242
|
+
gs = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
243
|
+
|
244
|
+
result = gs.query do
|
245
|
+
select name
|
246
|
+
from scenarios
|
247
|
+
with line /will not be found/
|
248
|
+
end
|
249
|
+
|
250
|
+
result.size.should == 0
|
251
|
+
|
252
|
+
end
|
253
|
+
|
254
|
+
it 'should filter none if all match regexp' do
|
255
|
+
repo = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/line_filter"
|
256
|
+
|
257
|
+
result = repo.query do
|
258
|
+
select name
|
259
|
+
from scenarios
|
260
|
+
with line /cat/
|
261
|
+
end
|
262
|
+
|
263
|
+
result.size.should == 2
|
264
|
+
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
269
|
+
describe 'tag search' do
|
270
|
+
it 'should return scenarios with matching tags' do
|
271
|
+
repo = CQL::Repository.new File.dirname(__FILE__) + "/../fixtures/features/scenario/tags"
|
272
|
+
|
273
|
+
result = repo.query do
|
274
|
+
select name
|
275
|
+
from scenarios
|
276
|
+
with tags '@one'
|
277
|
+
end
|
278
|
+
|
279
|
+
result.should == [{'name'=>'Next'},{'name'=>'Another'}]
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
# Has tag
|
284
|
+
# Name
|
285
|
+
# Name match
|
286
|
+
|
287
|
+
# Example count
|
288
288
|
end
|