diff options
Diffstat (limited to 'spec/active_relation/relations/schmoin_spec.rb')
-rw-r--r-- | spec/active_relation/relations/schmoin_spec.rb | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/spec/active_relation/relations/schmoin_spec.rb b/spec/active_relation/relations/schmoin_spec.rb deleted file mode 100644 index e5ed9be393..0000000000 --- a/spec/active_relation/relations/schmoin_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') - -module ActiveRelation - describe Schmoin do - before do - @relation = Table.new(:users) - photos = Table.new(:photos) - @aggregate_relation = photos.project(photos[:user_id], photos[:id].count).rename(photos[:id].count, :cnt) \ - .group(photos[:user_id]).as(:photo_count) - @predicate = Equality.new(@aggregate_relation[:user_id], @relation[:id]) - end - - describe '#to_sql' do - it 'manufactures sql joining the two tables on the predicate, merging the selects' do - Schmoin.new("INNER JOIN", @relation, @aggregate_relation, @predicate).to_sql.should be_like(""" - SELECT `users`.`name`, `users`.`id`, `photo_count`.`user_id`, `photo_count`.`cnt` - FROM `users` - INNER JOIN (SELECT `photos`.`user_id`, COUNT(`photos`.`id`) AS `cnt` FROM `photos` GROUP BY `photos`.`user_id`) AS `photo_count` - ON `photo_count`.`user_id` = `users`.`id` - """) - end - end - end -end
\ No newline at end of file |