aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-02-21 16:11:52 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-02-21 16:12:02 -0800
commitb3fcabb3a529e8ea3d2d6326b2d99aac4222cf06 (patch)
tree70af097be45f9202546920c718cf4abb6d22b434 /activerecord
parent442f8dbc69bd0a998b5dfdc35525668de436aca7 (diff)
downloadrails-b3fcabb3a529e8ea3d2d6326b2d99aac4222cf06.tar.gz
rails-b3fcabb3a529e8ea3d2d6326b2d99aac4222cf06.tar.bz2
rails-b3fcabb3a529e8ea3d2d6326b2d99aac4222cf06.zip
adding a test case for custom locking
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/custom_locking_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/custom_locking_test.rb b/activerecord/test/cases/custom_locking_test.rb
new file mode 100644
index 0000000000..d63ecdbcc5
--- /dev/null
+++ b/activerecord/test/cases/custom_locking_test.rb
@@ -0,0 +1,17 @@
+require "cases/helper"
+require 'models/person'
+
+module ActiveRecord
+ class CustomLockingTest < ActiveRecord::TestCase
+ fixtures :people
+
+ def test_custom_lock
+ if current_adapter?(:MysqlAdapter, :Mysql2Adapter)
+ assert_match 'SHARE MODE', Person.lock('LOCK IN SHARE MODE').to_sql
+ assert_sql(/LOCK IN SHARE MODE/) do
+ Person.find(1, :lock => 'LOCK IN SHARE MODE')
+ end
+ end
+ end
+ end
+end