Permalink
Browse files

Merge pull request #55 from samuelkadolph/add_predicates_to_function_…

…node

Include Arel::Predicates to Arel::Nodes::Function
  • Loading branch information...
2 parents 58c3d1d + 00d1482 commit 593002080cbcbb6e14acf3bc909aab819811f215 @tenderlove tenderlove committed May 27, 2011
Showing with 10 additions and 2 deletions.
  1. +1 −0 lib/arel/nodes/function.rb
  2. +0 −2 lib/arel/nodes/named_function.rb
  3. +9 −0 test/nodes/test_count.rb
View
1 lib/arel/nodes/function.rb
@@ -2,6 +2,7 @@ module Arel
module Nodes
class Function < Arel::Nodes::Node
include Arel::Expression
+ include Arel::Predications
attr_accessor :expressions, :alias, :distinct
def initialize expr, aliaz = nil
View
2 lib/arel/nodes/named_function.rb
@@ -3,8 +3,6 @@ module Nodes
class NamedFunction < Arel::Nodes::Function
attr_accessor :name
- include Arel::Predications
-
def initialize name, expr, aliaz = nil
super(expr, aliaz)
@name = name
View
9 test/nodes/test_count.rb
@@ -15,4 +15,13 @@
}
end
end
+
+ describe "eq" do
+ it "should compare the count" do
+ table = Arel::Table.new :users
+ table[:id].count.eq(2).to_sql.must_be_like %{
+ COUNT("users"."id") = 2
+ }
+ end
+ end
end

0 comments on commit 5930020

Please sign in to comment.