aboutsummaryrefslogtreecommitdiffstats
path: root/spec/attributes
diff options
context:
space:
mode:
authorErnie Miller <ernie@metautonomo.us>2010-09-29 12:54:13 -0400
committerErnie Miller <ernie@metautonomo.us>2010-09-29 12:54:13 -0400
commit261d284136567edfeb4dbfd9403ebd95e6bdae75 (patch)
tree7de52f16f8915dd0277ca8434b19127d4c700c7d /spec/attributes
parentd68165501fc80bbce34c43eaaf48381bcca27c15 (diff)
downloadrails-261d284136567edfeb4dbfd9403ebd95e6bdae75.tar.gz
rails-261d284136567edfeb4dbfd9403ebd95e6bdae75.tar.bz2
rails-261d284136567edfeb4dbfd9403ebd95e6bdae75.zip
Add eq_any.
Diffstat (limited to 'spec/attributes')
-rw-r--r--spec/attributes/attribute_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/attributes/attribute_spec.rb b/spec/attributes/attribute_spec.rb
index faef096792..6420028423 100644
--- a/spec/attributes/attribute_spec.rb
+++ b/spec/attributes/attribute_spec.rb
@@ -142,6 +142,22 @@ module Arel
end
end
+ describe '#eq_any' do
+ it 'should create a Grouping node' do
+ relation = Table.new(:users)
+ relation[:id].eq_any([1,2]).should be_kind_of Nodes::Grouping
+ end
+
+ it 'should generate multiple ORs in sql' do
+ relation = Table.new(:users)
+ mgr = relation.project relation[:id]
+ mgr.where relation[:id].eq_any([1,2])
+ mgr.to_sql.should be_like %{
+ SELECT "users"."id" FROM "users" WHERE ("users"."id" = 1 OR "users"."id" = 2)
+ }
+ end
+ end
+
describe '#in' do
it 'can be constructed with a list' do
end