aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/locking_test.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-01-29 07:40:52 -0800
committerYves Senn <yves.senn@gmail.com>2014-01-29 07:40:52 -0800
commit40e7fe3451df8e5b454f7d0472396d2429edc0e5 (patch)
tree7f63409243031eaaea72dad8b32ab1f980238a64 /activerecord/test/cases/locking_test.rb
parentf142527eb30626904cb1e655a1a28801f08b8acf (diff)
parent66e533f9b13f2ea1f56a19246af55621cc368489 (diff)
downloadrails-40e7fe3451df8e5b454f7d0472396d2429edc0e5.tar.gz
rails-40e7fe3451df8e5b454f7d0472396d2429edc0e5.tar.bz2
rails-40e7fe3451df8e5b454f7d0472396d2429edc0e5.zip
Merge pull request #13868 from mauricio/bug-13788
Correctly send the string given to lock! and reload(:lock) to the lock scope - fixes #13788
Diffstat (limited to 'activerecord/test/cases/locking_test.rb')
-rw-r--r--activerecord/test/cases/locking_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb
index a16ed963fe..c373dc1511 100644
--- a/activerecord/test/cases/locking_test.rb
+++ b/activerecord/test/cases/locking_test.rb
@@ -431,6 +431,17 @@ unless current_adapter?(:SybaseAdapter, :OpenBaseAdapter) || in_memory_db?
assert_equal old, person.reload.first_name
end
+ if current_adapter?(:PostgreSQLAdapter)
+ def test_lock_sending_custom_lock_statement
+ Person.transaction do
+ person = Person.find(1)
+ assert_sql(/LIMIT 1 FOR SHARE NOWAIT/) do
+ person.lock!('FOR SHARE NOWAIT')
+ end
+ end
+ end
+ end
+
if current_adapter?(:PostgreSQLAdapter, :OracleAdapter)
def test_no_locks_no_wait
first, second = duel { Person.find 1 }