Skip to content

Commit

Permalink
use parenthesis so limit works on all dbs
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Feb 9, 2011
1 parent cb1f841 commit d3b2596
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions activerecord/test/cases/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,11 @@ def test_limit_should_sanitize_sql_injection_for_limit_with_comas
Topic.limit("1, 7 procedure help()").all
end
end

unless current_adapter?(:MysqlAdapter)
def test_limit_should_allow_sql_literal
assert_equal 1, Topic.limit(Arel.sql('2-1')).all.length
end

def test_limit_should_allow_sql_literal
assert_equal 1, Topic.limit(Arel.sql('(2 - 1)')).all.length
end

def test_select_symbol
topic_ids = Topic.select(:id).map(&:id).sort
assert_equal Topic.find(:all).map(&:id).sort, topic_ids
Expand Down

0 comments on commit d3b2596

Please sign in to comment.