Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixing tests for oracle visitor

  • Loading branch information...
commit b035def39a8b4966fd33779bd5a2a9d0c9a33e66 1 parent 4acbe38
@tenderlove tenderlove authored
Showing with 8 additions and 7 deletions.
  1. +2 −1  lib/arel/visitors/visitor.rb
  2. +6 −6 test/visitors/test_oracle.rb
View
3  lib/arel/visitors/visitor.rb
@@ -13,7 +13,8 @@ def accept object
def visit object
send DISPATCH[object.class], object
- rescue NoMethodError
+ rescue NoMethodError => e
+ raise e if respond_to?(DISPATCH[object.class], true)
warn "visiting #{object.class} via superclass, this will be removed in arel 2.2.0" if $VERBOSE
superklass = object.class.ancestors.find { |klass|
respond_to?(DISPATCH[klass], true)
View
12 test/visitors/test_oracle.rb
@@ -59,7 +59,7 @@ module Visitors
describe 'limit' do
it 'adds a rownum clause' do
stmt = Nodes::SelectStatement.new
- stmt.limit = 10
+ stmt.limit = Nodes::Limit.new(10)
sql = @visitor.accept stmt
sql.must_be_like %{ SELECT WHERE ROWNUM <= 10 }
end
@@ -67,7 +67,7 @@ module Visitors
it 'is idempotent' do
stmt = Nodes::SelectStatement.new
stmt.orders << Nodes::SqlLiteral.new('foo')
- stmt.limit = 10
+ stmt.limit = Nodes::Limit.new(10)
sql = @visitor.accept stmt
sql2 = @visitor.accept stmt
sql.must_equal sql2
@@ -76,7 +76,7 @@ module Visitors
it 'creates a subquery when there is order_by' do
stmt = Nodes::SelectStatement.new
stmt.orders << Nodes::SqlLiteral.new('foo')
- stmt.limit = 10
+ stmt.limit = Nodes::Limit.new(10)
sql = @visitor.accept stmt
sql.must_be_like %{
SELECT * FROM (SELECT ORDER BY foo) WHERE ROWNUM <= 10
@@ -86,7 +86,7 @@ module Visitors
it 'creates a subquery when there is DISTINCT' do
stmt = Nodes::SelectStatement.new
stmt.cores.first.projections << Nodes::SqlLiteral.new('DISTINCT id')
- stmt.limit = 10
+ stmt.limit = Arel::Nodes::Limit.new(10)
sql = @visitor.accept stmt
sql.must_be_like %{
SELECT * FROM (SELECT DISTINCT id) WHERE ROWNUM <= 10
@@ -95,7 +95,7 @@ module Visitors
it 'creates a different subquery when there is an offset' do
stmt = Nodes::SelectStatement.new
- stmt.limit = 10
+ stmt.limit = Nodes::Limit.new(10)
stmt.offset = Nodes::Offset.new(10)
sql = @visitor.accept stmt
sql.must_be_like %{
@@ -110,7 +110,7 @@ module Visitors
it 'is idempotent with different subquery' do
stmt = Nodes::SelectStatement.new
- stmt.limit = 10
+ stmt.limit = Nodes::Limit.new(10)
stmt.offset = Nodes::Offset.new(10)
sql = @visitor.accept stmt
sql2 = @visitor.accept stmt
Please sign in to comment.
Something went wrong with that request. Please try again.