aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/locking_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/locking_test.rb')
-rw-r--r--activerecord/test/cases/locking_test.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb
index d0184ad2b3..f5c9945b37 100644
--- a/activerecord/test/cases/locking_test.rb
+++ b/activerecord/test/cases/locking_test.rb
@@ -125,7 +125,7 @@ class OptimisticLockingTest < ActiveRecord::TestCase
end
def test_lock_new
- p1 = Person.new(:first_name => "anika")
+ p1 = Person.new(first_name: "anika")
assert_equal 0, p1.lock_version
p1.first_name = "anika2"
@@ -144,7 +144,7 @@ class OptimisticLockingTest < ActiveRecord::TestCase
end
def test_lock_exception_record
- p1 = Person.new(:first_name => "mira")
+ p1 = Person.new(first_name: "mira")
assert_equal 0, p1.lock_version
p1.first_name = "mira2"
@@ -162,7 +162,7 @@ class OptimisticLockingTest < ActiveRecord::TestCase
end
def test_lock_new_with_nil
- p1 = Person.new(:first_name => "anika")
+ p1 = Person.new(first_name: "anika")
p1.save!
p1.lock_version = nil # simulate bad fixture or column with no default
p1.save!
@@ -170,7 +170,7 @@ class OptimisticLockingTest < ActiveRecord::TestCase
end
def test_lock_new_when_explicitly_passing_nil
- p1 = Person.new(:first_name => "anika", lock_version: nil)
+ p1 = Person.new(first_name: "anika", lock_version: nil)
p1.save!
assert_equal 0, p1.lock_version
end
@@ -209,7 +209,7 @@ class OptimisticLockingTest < ActiveRecord::TestCase
end
def test_lock_column_is_mass_assignable
- p1 = Person.create(:first_name => "bianca")
+ p1 = Person.create(first_name: "bianca")
assert_equal 0, p1.lock_version
assert_equal p1.lock_version, Person.new(p1.attributes).lock_version
@@ -242,7 +242,7 @@ class OptimisticLockingTest < ActiveRecord::TestCase
def test_readonly_attributes
assert_equal Set.new([ "name" ]), ReadonlyNameShip.readonly_attributes
- s = ReadonlyNameShip.create(:name => "unchangeable name")
+ s = ReadonlyNameShip.create(name: "unchangeable name")
s.reload
assert_equal "unchangeable name", s.name
@@ -261,7 +261,7 @@ class OptimisticLockingTest < ActiveRecord::TestCase
# is nothing else being updated.
def test_update_without_attributes_does_not_only_update_lock_version
assert_nothing_raised do
- p1 = Person.create!(:first_name => "anika")
+ p1 = Person.create!(first_name: "anika")
lock_version = p1.lock_version
p1.save
p1.reload
@@ -306,7 +306,7 @@ class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase
# of a test (see test_increment_counter_*).
self.use_transactional_tests = false
- { :lock_version => Person, :custom_lock_version => LegacyThing }.each do |name, model|
+ { lock_version: Person, custom_lock_version: LegacyThing }.each do |name, model|
define_method("test_increment_counter_updates_#{name}") do
counter_test model, 1 do |id|
model.increment_counter :test_count, id
@@ -321,7 +321,7 @@ class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase
define_method("test_update_counters_updates_#{name}") do
counter_test model, 1 do |id|
- model.update_counters id, :test_count => 1
+ model.update_counters id, test_count: 1
end
end
end
@@ -333,9 +333,9 @@ class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase
PersonalLegacyThing.reset_column_information
# Make sure that counter incrementing doesn't cause problems
- p1 = Person.new(:first_name => "fjord")
+ p1 = Person.new(first_name: "fjord")
p1.save!
- t = PersonalLegacyThing.new(:person => p1)
+ t = PersonalLegacyThing.new(person: p1)
t.save!
p1.reload
assert_equal 1, p1.personal_legacy_things_count
@@ -351,7 +351,7 @@ class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase
private
def add_counter_column_to(model, col="test_count")
- model.connection.add_column model.table_name, col, :integer, :null => false, :default => 0
+ model.connection.add_column model.table_name, col, :integer, null: false, default: 0
model.reset_column_information
end