veritas-sql-generator 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. data/.travis.yml +4 -2
  2. data/Gemfile +8 -9
  3. data/README.rdoc +17 -0
  4. data/Rakefile +2 -2
  5. data/TODO +0 -2
  6. data/lib/veritas/sql/generator/version.rb +1 -1
  7. data/spec/spec_helper.rb +2 -1
  8. data/spec/unit/veritas/sql/generator/literal/visit_time_spec.rb +2 -2
  9. data/spec/unit/veritas/sql/generator/relation/binary/visit_veritas_algebra_join_spec.rb +10 -10
  10. data/spec/unit/veritas/sql/generator/relation/binary/visit_veritas_algebra_product_spec.rb +18 -18
  11. data/spec/unit/veritas/sql/generator/relation/set/visit_veritas_algebra_difference_spec.rb +10 -10
  12. data/spec/unit/veritas/sql/generator/relation/set/visit_veritas_algebra_intersection_spec.rb +10 -10
  13. data/spec/unit/veritas/sql/generator/relation/set/visit_veritas_algebra_union_spec.rb +10 -10
  14. data/spec/unit/veritas/sql/generator/relation/unary/to_s_spec.rb +3 -3
  15. data/spec/unit/veritas/sql/generator/relation/unary/to_subquery_spec.rb +3 -3
  16. data/spec/unit/veritas/sql/generator/relation/unary/visit_veritas_algebra_extension_spec.rb +10 -10
  17. data/spec/unit/veritas/sql/generator/relation/unary/visit_veritas_algebra_projection_spec.rb +12 -12
  18. data/spec/unit/veritas/sql/generator/relation/unary/visit_veritas_algebra_rename_spec.rb +12 -12
  19. data/spec/unit/veritas/sql/generator/relation/unary/visit_veritas_algebra_restriction_spec.rb +17 -17
  20. data/spec/unit/veritas/sql/generator/relation/unary/visit_veritas_algebra_summarization_spec.rb +49 -49
  21. data/spec/unit/veritas/sql/generator/relation/unary/visit_veritas_relation_operation_limit_spec.rb +18 -18
  22. data/spec/unit/veritas/sql/generator/relation/unary/visit_veritas_relation_operation_offset_spec.rb +18 -18
  23. data/spec/unit/veritas/sql/generator/relation/unary/visit_veritas_relation_operation_order_spec.rb +21 -14
  24. data/spec/unit/veritas/sql/generator/relation/unary/visit_veritas_relation_operation_reverse_spec.rb +18 -18
  25. data/tasks/metrics/heckle.rake +1 -0
  26. data/veritas-sql-generator.gemspec +17 -17
  27. metadata +33 -33
@@ -16,8 +16,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
16
16
  let(:object) { described_class.new }
17
17
 
18
18
  context 'summarize per table dee' do
19
- let(:summarize_per) { TABLE_DEE }
20
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:age].count) } }
19
+ let(:summarize_per) { TABLE_DEE }
20
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.age.count) } }
21
21
 
22
22
  context 'when the operand is a base relation' do
23
23
  let(:operand) { base_relation }
@@ -38,8 +38,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
38
38
  end
39
39
 
40
40
  context 'when the operand is a projection' do
41
- let(:operand) { base_relation.project([ :id, :name ]) }
42
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:id].count) } }
41
+ let(:operand) { base_relation.project([ :id, :name ]) }
42
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.id.count) } }
43
43
 
44
44
  it_should_behave_like 'a generated SQL SELECT query'
45
45
 
@@ -57,7 +57,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
57
57
  end
58
58
 
59
59
  context 'when the operand is a restriction' do
60
- let(:operand) { base_relation.restrict { |r| r[:id].eq(1) } }
60
+ let(:operand) { base_relation.restrict { |r| r.id.eq(1) } }
61
61
 
62
62
  it_should_behave_like 'a generated SQL SELECT query'
63
63
 
@@ -66,8 +66,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
66
66
  end
67
67
 
68
68
  context 'when the operand is a summarization' do
69
- let(:operand) { base_relation.summarize([ :id ]) { |r| r.add(:count, r[:age].count) } }
70
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:count].count) } }
69
+ let(:operand) { base_relation.summarize([ :id ]) { |r| r.add(:count, r.age.count) } }
70
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.count.count) } }
71
71
 
72
72
  it_should_behave_like 'a generated SQL SELECT query'
73
73
 
@@ -76,7 +76,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
76
76
  end
77
77
 
78
78
  context 'when the operand is ordered' do
79
- let(:operand) { base_relation.order }
79
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] } }
80
80
 
81
81
  it_should_behave_like 'a generated SQL SELECT query'
82
82
 
@@ -85,7 +85,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
85
85
  end
86
86
 
87
87
  context 'when the operand is reversed' do
88
- let(:operand) { base_relation.order.reverse }
88
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.reverse }
89
89
 
90
90
  it_should_behave_like 'a generated SQL SELECT query'
91
91
 
@@ -94,7 +94,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
94
94
  end
95
95
 
96
96
  context 'when the operand is limited' do
97
- let(:operand) { base_relation.order.take(1) }
97
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.take(1) }
98
98
 
99
99
  it_should_behave_like 'a generated SQL SELECT query'
100
100
 
@@ -103,7 +103,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
103
103
  end
104
104
 
105
105
  context 'when the operand is an offset' do
106
- let(:operand) { base_relation.order.drop(1) }
106
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.drop(1) }
107
107
 
108
108
  it_should_behave_like 'a generated SQL SELECT query'
109
109
 
@@ -149,8 +149,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
149
149
  end
150
150
 
151
151
  context 'summarize per table dum' do
152
- let(:summarize_per) { TABLE_DUM }
153
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:age].count) } }
152
+ let(:summarize_per) { TABLE_DUM }
153
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.age.count) } }
154
154
 
155
155
  context 'when the operand is a base relation' do
156
156
  let(:operand) { base_relation }
@@ -171,8 +171,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
171
171
  end
172
172
 
173
173
  context 'when the operand is a projection' do
174
- let(:operand) { base_relation.project([ :id, :name ]) }
175
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:id].count) } }
174
+ let(:operand) { base_relation.project([ :id, :name ]) }
175
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.id.count) } }
176
176
 
177
177
  it_should_behave_like 'a generated SQL SELECT query'
178
178
 
@@ -190,7 +190,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
190
190
  end
191
191
 
192
192
  context 'when the operand is a restriction' do
193
- let(:operand) { base_relation.restrict { |r| r[:id].eq(1) } }
193
+ let(:operand) { base_relation.restrict { |r| r.id.eq(1) } }
194
194
 
195
195
  it_should_behave_like 'a generated SQL SELECT query'
196
196
 
@@ -199,8 +199,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
199
199
  end
200
200
 
201
201
  context 'when the operand is a summarization' do
202
- let(:operand) { base_relation.summarize([ :id ]) { |r| r.add(:count, r[:age].count) } }
203
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:count].count) } }
202
+ let(:operand) { base_relation.summarize([ :id ]) { |r| r.add(:count, r.age.count) } }
203
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.count.count) } }
204
204
 
205
205
  it_should_behave_like 'a generated SQL SELECT query'
206
206
 
@@ -209,7 +209,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
209
209
  end
210
210
 
211
211
  context 'when the operand is ordered' do
212
- let(:operand) { base_relation.order }
212
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] } }
213
213
 
214
214
  it_should_behave_like 'a generated SQL SELECT query'
215
215
 
@@ -218,7 +218,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
218
218
  end
219
219
 
220
220
  context 'when the operand is reversed' do
221
- let(:operand) { base_relation.order.reverse }
221
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.reverse }
222
222
 
223
223
  it_should_behave_like 'a generated SQL SELECT query'
224
224
 
@@ -227,7 +227,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
227
227
  end
228
228
 
229
229
  context 'when the operand is limited' do
230
- let(:operand) { base_relation.order.take(1) }
230
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.take(1) }
231
231
 
232
232
  it_should_behave_like 'a generated SQL SELECT query'
233
233
 
@@ -236,7 +236,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
236
236
  end
237
237
 
238
238
  context 'when the operand is an offset' do
239
- let(:operand) { base_relation.order.drop(1) }
239
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.drop(1) }
240
240
 
241
241
  it_should_behave_like 'a generated SQL SELECT query'
242
242
 
@@ -282,8 +282,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
282
282
  end
283
283
 
284
284
  context 'summarize by a subset of the operand header' do
285
- let(:summarize_by) { [ :id ] }
286
- let(:summarization) { operand.summarize(summarize_by) { |r| r.add(:count, r[:age].count) } }
285
+ let(:summarize_by) { [ :id ] }
286
+ let(:summarization) { operand.summarize(summarize_by) { |r| r.add(:count, r.age.count) } }
287
287
 
288
288
  context 'when the operand is a base relation' do
289
289
  let(:operand) { base_relation }
@@ -295,8 +295,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
295
295
  end
296
296
 
297
297
  context 'when the operand is a projection' do
298
- let(:operand) { base_relation.project([ :id, :name ]) }
299
- let(:summarization) { operand.summarize(summarize_by) { |r| r.add(:count, r[:name].count) } }
298
+ let(:operand) { base_relation.project([ :id, :name ]) }
299
+ let(:summarization) { operand.summarize(summarize_by) { |r| r.add(:count, r.name.count) } }
300
300
 
301
301
  it_should_behave_like 'a generated SQL SELECT query'
302
302
 
@@ -323,7 +323,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
323
323
  end
324
324
 
325
325
  context 'when the operand is a restriction' do
326
- let(:operand) { base_relation.restrict { |r| r[:id].eq(1) } }
326
+ let(:operand) { base_relation.restrict { |r| r.id.eq(1) } }
327
327
 
328
328
  it_should_behave_like 'a generated SQL SELECT query'
329
329
 
@@ -332,7 +332,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
332
332
  end
333
333
 
334
334
  context 'when the operand is ordered' do
335
- let(:operand) { base_relation.order }
335
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] } }
336
336
 
337
337
  it_should_behave_like 'a generated SQL SELECT query'
338
338
 
@@ -341,7 +341,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
341
341
  end
342
342
 
343
343
  context 'when the operand is reversed' do
344
- let(:operand) { base_relation.order.reverse }
344
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.reverse }
345
345
 
346
346
  it_should_behave_like 'a generated SQL SELECT query'
347
347
 
@@ -350,7 +350,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
350
350
  end
351
351
 
352
352
  context 'when the operand is limited' do
353
- let(:operand) { base_relation.order.take(1) }
353
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.take(1) }
354
354
 
355
355
  it_should_behave_like 'a generated SQL SELECT query'
356
356
 
@@ -359,7 +359,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
359
359
  end
360
360
 
361
361
  context 'when the operand is an offset' do
362
- let(:operand) { base_relation.order.drop(1) }
362
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.drop(1) }
363
363
 
364
364
  it_should_behave_like 'a generated SQL SELECT query'
365
365
 
@@ -405,8 +405,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
405
405
  end
406
406
 
407
407
  context 'summarize per another base relation' do
408
- let(:summarize_per) { other_relation }
409
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:age].count) } }
408
+ let(:summarize_per) { other_relation }
409
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.age.count) } }
410
410
 
411
411
  context 'when the operand is a base relation' do
412
412
  let(:operand) { base_relation }
@@ -418,8 +418,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
418
418
  end
419
419
 
420
420
  context 'when the operand is a projection' do
421
- let(:operand) { base_relation.project([ :id, :name ]) }
422
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:name].count) } }
421
+ let(:operand) { base_relation.project([ :id, :name ]) }
422
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.name.count) } }
423
423
 
424
424
  it_should_behave_like 'a generated SQL SELECT query'
425
425
 
@@ -446,7 +446,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
446
446
  end
447
447
 
448
448
  context 'when the operand is a restriction' do
449
- let(:operand) { base_relation.restrict { |r| r[:id].eq(1) } }
449
+ let(:operand) { base_relation.restrict { |r| r.id.eq(1) } }
450
450
 
451
451
  it_should_behave_like 'a generated SQL SELECT query'
452
452
 
@@ -455,7 +455,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
455
455
  end
456
456
 
457
457
  context 'when the operand is ordered' do
458
- let(:operand) { base_relation.order }
458
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] } }
459
459
 
460
460
  it_should_behave_like 'a generated SQL SELECT query'
461
461
 
@@ -464,7 +464,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
464
464
  end
465
465
 
466
466
  context 'when the operand is reversed' do
467
- let(:operand) { base_relation.order.reverse }
467
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.reverse }
468
468
 
469
469
  it_should_behave_like 'a generated SQL SELECT query'
470
470
 
@@ -473,7 +473,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
473
473
  end
474
474
 
475
475
  context 'when the operand is limited' do
476
- let(:operand) { base_relation.order.take(1) }
476
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.take(1) }
477
477
 
478
478
  it_should_behave_like 'a generated SQL SELECT query'
479
479
 
@@ -482,7 +482,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
482
482
  end
483
483
 
484
484
  context 'when the operand is an offset' do
485
- let(:operand) { base_relation.order.drop(1) }
485
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.drop(1) }
486
486
 
487
487
  it_should_behave_like 'a generated SQL SELECT query'
488
488
 
@@ -528,8 +528,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
528
528
  end
529
529
 
530
530
  context 'summarize per another projected relation' do
531
- let(:summarize_per) { other_relation.project([ :id ]) }
532
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:age].count) } }
531
+ let(:summarize_per) { other_relation.project([ :id ]) }
532
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.age.count) } }
533
533
 
534
534
  context 'when the operand is a base relation' do
535
535
  let(:operand) { base_relation }
@@ -541,8 +541,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
541
541
  end
542
542
 
543
543
  context 'when the operand is a projection' do
544
- let(:operand) { base_relation.project([ :id, :name ]) }
545
- let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r[:name].count) } }
544
+ let(:operand) { base_relation.project([ :id, :name ]) }
545
+ let(:summarization) { operand.summarize(summarize_per) { |r| r.add(:count, r.name.count) } }
546
546
 
547
547
  it_should_behave_like 'a generated SQL SELECT query'
548
548
 
@@ -569,7 +569,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
569
569
  end
570
570
 
571
571
  context 'when the operand is a restriction' do
572
- let(:operand) { base_relation.restrict { |r| r[:id].eq(1) } }
572
+ let(:operand) { base_relation.restrict { |r| r.id.eq(1) } }
573
573
 
574
574
  it_should_behave_like 'a generated SQL SELECT query'
575
575
 
@@ -578,7 +578,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
578
578
  end
579
579
 
580
580
  context 'when the operand is ordered' do
581
- let(:operand) { base_relation.order }
581
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] } }
582
582
 
583
583
  it_should_behave_like 'a generated SQL SELECT query'
584
584
 
@@ -587,7 +587,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
587
587
  end
588
588
 
589
589
  context 'when the operand is reversed' do
590
- let(:operand) { base_relation.order.reverse }
590
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.reverse }
591
591
 
592
592
  it_should_behave_like 'a generated SQL SELECT query'
593
593
 
@@ -596,7 +596,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
596
596
  end
597
597
 
598
598
  context 'when the operand is limited' do
599
- let(:operand) { base_relation.order.take(1) }
599
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.take(1) }
600
600
 
601
601
  it_should_behave_like 'a generated SQL SELECT query'
602
602
 
@@ -605,7 +605,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_algebra_summarization'
605
605
  end
606
606
 
607
607
  context 'when the operand is an offset' do
608
- let(:operand) { base_relation.order.drop(1) }
608
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.drop(1) }
609
609
 
610
610
  it_should_behave_like 'a generated SQL SELECT query'
611
611
 
@@ -16,7 +16,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
16
16
  let(:object) { described_class.new }
17
17
 
18
18
  context 'when the operand is a base relation' do
19
- let(:operand) { base_relation.order }
19
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] } }
20
20
 
21
21
  it_should_behave_like 'a generated SQL SELECT query'
22
22
 
@@ -25,7 +25,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
25
25
  end
26
26
 
27
27
  context 'when the operand is a projection' do
28
- let(:operand) { base_relation.project([ :id, :name ]).order }
28
+ let(:operand) { base_relation.project([ :id, :name ]).sort_by { |r| [ r.id, r.name ] } }
29
29
 
30
30
  it_should_behave_like 'a generated SQL SELECT query'
31
31
 
@@ -34,7 +34,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
34
34
  end
35
35
 
36
36
  context 'when the operand is an extension' do
37
- let(:operand) { base_relation.extend { |r| r.add(:one, 1) }.order }
37
+ let(:operand) { base_relation.extend { |r| r.add(:one, 1) }.sort_by { |r| [ r.id, r.name, r.age, r.one ] } }
38
38
 
39
39
  it_should_behave_like 'a generated SQL SELECT query'
40
40
 
@@ -43,7 +43,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
43
43
  end
44
44
 
45
45
  context 'when the operand is a rename' do
46
- let(:operand) { base_relation.order.rename(:id => :user_id) }
46
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.rename(:id => :user_id) }
47
47
 
48
48
  it_should_behave_like 'a generated SQL SELECT query'
49
49
 
@@ -52,7 +52,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
52
52
  end
53
53
 
54
54
  context 'when the operand is a restriction' do
55
- let(:operand) { base_relation.restrict { |r| r[:id].eq(1) }.order }
55
+ let(:operand) { base_relation.restrict { |r| r.id.eq(1) }.sort_by { |r| [ r.id, r.name, r.age ] } }
56
56
 
57
57
  it_should_behave_like 'a generated SQL SELECT query'
58
58
 
@@ -62,8 +62,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
62
62
 
63
63
  context 'when the operand is a summarization' do
64
64
  context 'summarize per table dee' do
65
- let(:summarize_per) { TABLE_DEE }
66
- let(:operand) { base_relation.summarize(summarize_per) { |r| r.add(:count, r[:id].count) }.order }
65
+ let(:summarize_per) { TABLE_DEE }
66
+ let(:operand) { base_relation.summarize(summarize_per) { |r| r.add(:count, r.id.count) }.sort_by { |r| r.count } }
67
67
 
68
68
  it_should_behave_like 'a generated SQL SELECT query'
69
69
 
@@ -72,8 +72,8 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
72
72
  end
73
73
 
74
74
  context 'summarize per table dum' do
75
- let(:summarize_per) { TABLE_DUM }
76
- let(:operand) { base_relation.summarize(summarize_per) { |r| r.add(:count, r[:id].count) }.order }
75
+ let(:summarize_per) { TABLE_DUM }
76
+ let(:operand) { base_relation.summarize(summarize_per) { |r| r.add(:count, r.id.count) }.sort_by { |r| r.count } }
77
77
 
78
78
  it_should_behave_like 'a generated SQL SELECT query'
79
79
 
@@ -82,7 +82,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
82
82
  end
83
83
 
84
84
  context 'summarize by a subset of the operand header' do
85
- let(:operand) { base_relation.summarize([ :id, :name ]) { |r| r.add(:count, r[:age].count) }.order }
85
+ let(:operand) { base_relation.summarize([ :id, :name ]) { |r| r.add(:count, r.age.count) }.sort_by { |r| [ r.id, r.name, r.count ] } }
86
86
 
87
87
  it_should_behave_like 'a generated SQL SELECT query'
88
88
 
@@ -92,7 +92,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
92
92
  end
93
93
 
94
94
  context 'when the operand is ordered' do
95
- let(:operand) { base_relation.order }
95
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] } }
96
96
 
97
97
  it_should_behave_like 'a generated SQL SELECT query'
98
98
 
@@ -101,7 +101,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
101
101
  end
102
102
 
103
103
  context 'when the operand is reversed' do
104
- let(:operand) { base_relation.order.reverse }
104
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.reverse }
105
105
 
106
106
  it_should_behave_like 'a generated SQL SELECT query'
107
107
 
@@ -110,7 +110,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
110
110
  end
111
111
 
112
112
  context 'when the operand is limited' do
113
- let(:operand) { base_relation.order.take(1) }
113
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.take(1) }
114
114
 
115
115
  it_should_behave_like 'a generated SQL SELECT query'
116
116
 
@@ -119,7 +119,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
119
119
  end
120
120
 
121
121
  context 'when the operand is an offset' do
122
- let(:operand) { base_relation.order.drop(1) }
122
+ let(:operand) { base_relation.sort_by { |r| [ r.id, r.name, r.age ] }.drop(1) }
123
123
 
124
124
  it_should_behave_like 'a generated SQL SELECT query'
125
125
 
@@ -128,7 +128,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
128
128
  end
129
129
 
130
130
  context 'when the operand is a difference' do
131
- let(:operand) { base_relation.difference(base_relation).order }
131
+ let(:operand) { base_relation.difference(base_relation).sort_by { |r| [ r.id, r.name, r.age ] } }
132
132
 
133
133
  it_should_behave_like 'a generated SQL SELECT query'
134
134
 
@@ -137,7 +137,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
137
137
  end
138
138
 
139
139
  context 'when the operand is an intersection' do
140
- let(:operand) { base_relation.intersect(base_relation).order }
140
+ let(:operand) { base_relation.intersect(base_relation).sort_by { |r| [ r.id, r.name, r.age ] } }
141
141
 
142
142
  it_should_behave_like 'a generated SQL SELECT query'
143
143
 
@@ -146,7 +146,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
146
146
  end
147
147
 
148
148
  context 'when the operand is a union' do
149
- let(:operand) { base_relation.union(base_relation).order }
149
+ let(:operand) { base_relation.union(base_relation).sort_by { |r| [ r.id, r.name, r.age ] } }
150
150
 
151
151
  it_should_behave_like 'a generated SQL SELECT query'
152
152
 
@@ -155,7 +155,7 @@ describe SQL::Generator::Relation::Unary, '#visit_veritas_relation_operation_lim
155
155
  end
156
156
 
157
157
  context 'when the operand is a join' do
158
- let(:operand) { base_relation.join(base_relation).order }
158
+ let(:operand) { base_relation.join(base_relation).sort_by { |r| [ r.id, r.name, r.age ] } }
159
159
 
160
160
  it_should_behave_like 'a generated SQL SELECT query'
161
161