aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-08-27 23:41:29 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-11 20:48:50 -0300
commitf13b278568a1d629dd4d90b16ed87b715c4e689d (patch)
treeb97b8d904a17559b952216296a1d28756e303f63 /activerecord/test/cases
parent3d60e9d5503b5f657336a8b7ee6345552ddb6c83 (diff)
downloadrails-f13b278568a1d629dd4d90b16ed87b715c4e689d.tar.gz
rails-f13b278568a1d629dd4d90b16ed87b715c4e689d.tar.bz2
rails-f13b278568a1d629dd4d90b16ed87b715c4e689d.zip
Check if the SQL is not a prepared statement
When the adapter is with prepared statement disabled and the binds array is not empty the connection adapter will try to set the binds values and will fail. Now we are checking if the adapter has the prepared statement disabled. Fixes #12023
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/base_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index dc2de7b523..e3b441280b 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -565,6 +565,14 @@ class BasicsTest < ActiveRecord::TestCase
assert_equal [topic_2, topic_1].sort, [topic_1, topic_2]
end
+ def test_create_without_prepared_statement
+ topic = Topic.connection.unprepared_statement do
+ Topic.create(:title => 'foo')
+ end
+
+ assert_equal topic, Topic.find(topic.id)
+ end
+
def test_comparison_with_different_objects
topic = Topic.create
category = Category.create(:name => "comparison")