aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-01-03 16:20:03 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-03 16:20:03 -0800
commit3a2133d54f903d997b68930c0c6adc58716a253c (patch)
tree354b93dbcc4b647f9b181ded1c1a295ac2ed6611 /test
parentd7ff05e240770c1946fe4c0c1f74880ecd180b09 (diff)
parentf5e09790550fcb7d413d495be25f8fe74a571850 (diff)
downloadrails-3a2133d54f903d997b68930c0c6adc58716a253c.tar.gz
rails-3a2133d54f903d997b68930c0c6adc58716a253c.tar.bz2
rails-3a2133d54f903d997b68930c0c6adc58716a253c.zip
Merge branch '2-0-stable'
* 2-0-stable: adding better tests surrounding limits in adapter visitors
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_mysql.rb4
-rw-r--r--test/visitors/test_postgres.rb6
2 files changed, 6 insertions, 4 deletions
diff --git a/test/visitors/test_mysql.rb b/test/visitors/test_mysql.rb
index 135348580d..c3b79ca667 100644
--- a/test/visitors/test_mysql.rb
+++ b/test/visitors/test_mysql.rb
@@ -19,8 +19,8 @@ module Arel
it "should escape LIMIT" do
sc = Arel::Nodes::UpdateStatement.new
- sc.limit = "omg"
- assert_match(/LIMIT 'omg'/, @visitor.accept(sc))
+ sc.limit = Nodes::Limit.new("omg")
+ assert_equal("UPDATE NULL LIMIT 'omg'", @visitor.accept(sc))
end
it 'uses DUAL for empty from' do
diff --git a/test/visitors/test_postgres.rb b/test/visitors/test_postgres.rb
index b98f78ca12..6e8f399b6b 100644
--- a/test/visitors/test_postgres.rb
+++ b/test/visitors/test_postgres.rb
@@ -15,10 +15,12 @@ module Arel
it "should escape LIMIT" do
sc = Arel::Nodes::SelectStatement.new
- sc.limit = "omg"
+ sc.limit = Nodes::Limit.new("omg")
sc.cores.first.projections << 'DISTINCT ON'
sc.orders << "xyz"
- assert_match(/LIMIT 'omg'/, @visitor.accept(sc))
+ sql = @visitor.accept(sc)
+ assert_match(/LIMIT 'omg'/, sql)
+ assert_equal 1, sql.scan(/LIMIT/).length, 'should have one limit'
end
end
end