diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-22 10:31:47 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-22 10:31:47 -0800 |
commit | e68bc3f14ea93eabdd4274e66071b65debb5a0a8 (patch) | |
tree | 223c11f38dac1217d8e7e3cd427fdf6018975a9d /activerecord/test/cases/locking_test.rb | |
parent | 3cb46b40a0df1a1f4912625cc2be40b3d630f1f3 (diff) | |
parent | e1935e3c0c35f8f1196239e2b1213c4436049fa5 (diff) | |
download | rails-e68bc3f14ea93eabdd4274e66071b65debb5a0a8.tar.gz rails-e68bc3f14ea93eabdd4274e66071b65debb5a0a8.tar.bz2 rails-e68bc3f14ea93eabdd4274e66071b65debb5a0a8.zip |
Merge commit 'origin/master' into mail
Diffstat (limited to 'activerecord/test/cases/locking_test.rb')
-rw-r--r-- | activerecord/test/cases/locking_test.rb | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index e177235591..a64c01292f 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -38,24 +38,6 @@ class OptimisticLockingTest < ActiveRecord::TestCase assert_raise(ActiveRecord::StaleObjectError) { p2.save! } end - def test_lock_destroy - p1 = Person.find(1) - p2 = Person.find(1) - assert_equal 0, p1.lock_version - assert_equal 0, p2.lock_version - - p1.first_name = 'stu' - p1.save! - assert_equal 1, p1.lock_version - assert_equal 0, p2.lock_version - - assert_raises(ActiveRecord::StaleObjectError) { p2.destroy } - - assert p1.destroy - assert_equal true, p1.frozen? - assert_raises(ActiveRecord::RecordNotFound) { Person.find(1) } - end - def test_lock_repeating p1 = Person.find(1) p2 = Person.find(1) @@ -282,11 +264,14 @@ unless current_adapter?(:SybaseAdapter, :OpenBaseAdapter) assert first.end > second.end end - def test_second_lock_waits - assert [0.2, 1, 5].any? { |zzz| - first, second = duel(zzz) { Person.find 1, :lock => true } - second.end > first.end - } + # Hit by ruby deadlock detection since connection checkout is mutexed. + if RUBY_VERSION < '1.9.0' + def test_second_lock_waits + assert [0.2, 1, 5].any? { |zzz| + first, second = duel(zzz) { Person.find 1, :lock => true } + second.end > first.end + } + end end protected |