diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-03-17 11:28:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-17 11:28:50 -0400 |
commit | 3666962dd031b2d0e028f4fc6b52e0f19d573798 (patch) | |
tree | 8bca3ae6a2beb369f2f8e439cddbcb4d81cee277 /activerecord/test | |
parent | 73b86ac58b61b4c7b888962252a1a86dffb24081 (diff) | |
parent | 5a072ba317aa180b3622145003fb3ed8b93d226f (diff) | |
download | rails-3666962dd031b2d0e028f4fc6b52e0f19d573798.tar.gz rails-3666962dd031b2d0e028f4fc6b52e0f19d573798.tar.bz2 rails-3666962dd031b2d0e028f4fc6b52e0f19d573798.zip |
Merge pull request #28318 from bogdanvlviv/remove-ability-update-locking_column-value
Remove ability update locking_column value
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/dirty_test.rb | 3 | ||||
-rw-r--r-- | activerecord/test/cases/locking_test.rb | 34 |
2 files changed, 2 insertions, 35 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index c13a962e3e..f9eccfbda1 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -349,13 +349,14 @@ class DirtyTest < ActiveRecord::TestCase def test_partial_update_with_optimistic_locking person = Person.new(first_name: "foo") - old_lock_version = person.lock_version with_partial_writes Person, false do assert_queries(2) { 2.times { person.save! } } Person.where(id: person.id).update_all(first_name: "baz") end + old_lock_version = person.lock_version + with_partial_writes Person, true do assert_queries(0) { 2.times { person.save! } } assert_equal old_lock_version, person.reload.lock_version diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index 23095618a4..3a3b8e51f9 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -247,17 +247,6 @@ class OptimisticLockingTest < ActiveRecord::TestCase assert_equal "new title2", t2.title end - def test_lock_without_default_should_update_with_lock_col - t1 = LockWithoutDefault.create(title: "title1", lock_version: 6) - - assert_equal 6, t1.lock_version - - t1.update(lock_version: 0) - t1.reload - - assert_equal 0, t1.lock_version - end - def test_lock_without_default_queries_count t1 = LockWithoutDefault.create(title: "title1") @@ -270,12 +259,6 @@ class OptimisticLockingTest < ActiveRecord::TestCase assert_equal "title2", t1.title assert_equal 1, t1.lock_version - assert_queries(1) { t1.update(title: "title3", lock_version: 6) } - - t1.reload - assert_equal "title3", t1.title - assert_equal 6, t1.lock_version - t2 = LockWithoutDefault.new(title: "title1") assert_queries(1) { t2.save! } @@ -321,17 +304,6 @@ class OptimisticLockingTest < ActiveRecord::TestCase assert_equal "new title2", t2.title end - def test_lock_with_custom_column_without_default_should_update_with_lock_col - t1 = LockWithCustomColumnWithoutDefault.create(title: "title1", custom_lock_version: 6) - - assert_equal 6, t1.custom_lock_version - - t1.update(custom_lock_version: 0) - t1.reload - - assert_equal 0, t1.custom_lock_version - end - def test_lock_with_custom_column_without_default_queries_count t1 = LockWithCustomColumnWithoutDefault.create(title: "title1") @@ -344,12 +316,6 @@ class OptimisticLockingTest < ActiveRecord::TestCase assert_equal "title2", t1.title assert_equal 1, t1.custom_lock_version - assert_queries(1) { t1.update(title: "title3", custom_lock_version: 6) } - - t1.reload - assert_equal "title3", t1.title - assert_equal 6, t1.custom_lock_version - t2 = LockWithCustomColumnWithoutDefault.new(title: "title1") assert_queries(1) { t2.save! } |