diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/active_relation/predicates/binary_spec.rb | 2 | ||||
-rw-r--r-- | spec/active_relation/relations/projection_spec.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/spec/active_relation/predicates/binary_spec.rb b/spec/active_relation/predicates/binary_spec.rb index 127375f24c..89a40d2bf3 100644 --- a/spec/active_relation/predicates/binary_spec.rb +++ b/spec/active_relation/predicates/binary_spec.rb @@ -41,7 +41,7 @@ module ActiveRelation end describe '#to_sql' do - it 'manufactures correct sql' do + it 'manufactures sql with a binary operation' do ConcreteBinary.new(@attribute1, @attribute2).to_sql.should be_like(""" `users`.`id` <=> `photos`.`id` """) diff --git a/spec/active_relation/relations/projection_spec.rb b/spec/active_relation/relations/projection_spec.rb index 739a16c8ef..2bc4ed1d6e 100644 --- a/spec/active_relation/relations/projection_spec.rb +++ b/spec/active_relation/relations/projection_spec.rb @@ -44,6 +44,12 @@ module ActiveRelation FROM `users` """) end + + it "manufactures sql with scalar selects" do + Projection.new(@relation, Projection.new(@relation, @relation[:name])).to_sql.should be_like(""" + SELECT (SELECT `users`.`name` FROM `users`) FROM `users` + """) + end end end end
\ No newline at end of file |