aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorNick Kallen <nkallen@nick-kallens-computer-2.local>2008-02-16 20:55:29 -0800
committerNick Kallen <nkallen@nick-kallens-computer-2.local>2008-02-16 20:55:29 -0800
commit7354602f6f11db09f7e58a833dcf9cb141abf50a (patch)
tree460f08b06d53560c024072119511cc5992206bd3 /spec
parent99b2188f9495068399000b891c2c9b66331c4b02 (diff)
downloadrails-7354602f6f11db09f7e58a833dcf9cb141abf50a.tar.gz
rails-7354602f6f11db09f7e58a833dcf9cb141abf50a.tar.bz2
rails-7354602f6f11db09f7e58a833dcf9cb141abf50a.zip
adding support for scalar selects
Diffstat (limited to 'spec')
-rw-r--r--spec/active_relation/predicates/binary_spec.rb2
-rw-r--r--spec/active_relation/relations/projection_spec.rb6
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