Skip to content

Commit

Permalink
Fix typo and add missing spec coverage. Fixes activerecord-hackery#65
Browse files Browse the repository at this point in the history
  • Loading branch information
ernie committed Sep 30, 2011
1 parent dcf818d commit b0c5508
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/squeel/version.rb
@@ -1,3 +1,3 @@
module Squeel
VERSION = "0.9.2"
VERSION = "0.9.3"
end
2 changes: 1 addition & 1 deletion lib/squeel/visitors/predicate_visitor.rb
Expand Up @@ -197,7 +197,7 @@ def visit_Squeel_Nodes_Operation(o, parent)
when :/
Arel::Nodes::Division.new(args[0], args[1])
else
Arel::Nodes::InfixOperation(o.operator, args[0], args[1])
Arel::Nodes::InfixOperation.new(o.operator, args[0], args[1])
end
o.alias ? op.as(o.alias) : op
end
Expand Down
5 changes: 5 additions & 0 deletions spec/squeel/visitors/predicate_visitor_spec.rb
Expand Up @@ -404,6 +404,11 @@ module Visitors
operation.should be_a Arel::Nodes::Division
end

it 'creates an ARel InfixOperation node for an Operation with a custom operator' do
operation = @v.accept(dsl{id.op(:blah, 1)})
operation.should be_a Arel::Nodes::InfixOperation
end

it 'sets the alias on an InfixOperation from the Operation alias' do
operation = @v.accept(dsl{(id + 1).as(:incremented_id)})
operation.to_sql.should match /incremented_id/
Expand Down

0 comments on commit b0c5508

Please sign in to comment.