cql 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/spec/filter_feature_dsl_spec.rb +485 -485
- data/spec/filter_sso_spec.rb +287 -278
- 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 +6 -9
- data/lib/dsl.rb +0 -64
- data/lib/map_reduce.rb +0 -139
- data/lib/repo.rb +0 -34
data/spec/filter_sso_spec.rb
CHANGED
@@ -1,279 +1,288 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require File.dirname(__FILE__) + "/../lib/repo"
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
1
|
+
require 'rspec'
|
2
|
+
require File.dirname(__FILE__) + "/../lib/repo"
|
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
|
279
288
|
end
|