aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/transactions_test.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 19:37:57 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 19:37:57 +0200
commitd22e522179c1c90e658c3ed0e9b972ec62306209 (patch)
tree3ccbdff567b79a128ad61adcbb4f2950ca9b696e /activerecord/test/cases/transactions_test.rb
parentfa911a74e15ef34bb435812f7d9cf7324253476f (diff)
downloadrails-d22e522179c1c90e658c3ed0e9b972ec62306209.tar.gz
rails-d22e522179c1c90e658c3ed0e9b972ec62306209.tar.bz2
rails-d22e522179c1c90e658c3ed0e9b972ec62306209.zip
modernizes hash syntax in activerecord
Diffstat (limited to 'activerecord/test/cases/transactions_test.rb')
-rw-r--r--activerecord/test/cases/transactions_test.rb38
1 files changed, 19 insertions, 19 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb
index e775983817..6dcbc9559c 100644
--- a/activerecord/test/cases/transactions_test.rb
+++ b/activerecord/test/cases/transactions_test.rb
@@ -260,14 +260,14 @@ class TransactionTest < ActiveRecord::TestCase
end
}
- new_topic = topic.new(:title => "A new topic",
- :author_name => "Ben",
- :author_email_address => "ben@example.com",
- :written_on => "2003-07-16t15:28:11.2233+01:00",
- :last_read => "2004-04-15",
- :bonus_time => "2005-01-30t15:28:00.00+01:00",
- :content => "Have a nice day",
- :approved => false)
+ new_topic = topic.new(title: "A new topic",
+ author_name: "Ben",
+ author_email_address: "ben@example.com",
+ written_on: "2003-07-16t15:28:11.2233+01:00",
+ last_read: "2004-04-15",
+ bonus_time: "2005-01-30t15:28:00.00+01:00",
+ content: "Have a nice day",
+ approved: false)
new_record_snapshot = !new_topic.persisted?
id_present = new_topic.has_attribute?(Topic.primary_key)
@@ -291,7 +291,7 @@ class TransactionTest < ActiveRecord::TestCase
end
}
- new_topic = topic.create(:title => "A new topic")
+ new_topic = topic.create(title: "A new topic")
assert !new_topic.persisted?, "The topic should not be persisted"
assert_nil new_topic.id, "The topic should not have an ID"
end
@@ -329,7 +329,7 @@ class TransactionTest < ActiveRecord::TestCase
def test_invalid_keys_for_transaction
assert_raise ArgumentError do
- Topic.transaction :nested => true do
+ Topic.transaction nested: true do
end
end
end
@@ -342,7 +342,7 @@ class TransactionTest < ActiveRecord::TestCase
@second.save!
begin
- Topic.transaction :requires_new => true do
+ Topic.transaction requires_new: true do
@first.happy = false
@first.save!
raise
@@ -363,7 +363,7 @@ class TransactionTest < ActiveRecord::TestCase
@second.save!
begin
- @second.transaction :requires_new => true do
+ @second.transaction requires_new: true do
@first.happy = false
@first.save!
raise
@@ -403,17 +403,17 @@ class TransactionTest < ActiveRecord::TestCase
@first.save!
begin
- Topic.transaction :requires_new => true do
+ Topic.transaction requires_new: true do
@first.content = "Two"
@first.save!
begin
- Topic.transaction :requires_new => true do
+ Topic.transaction requires_new: true do
@first.content = "Three"
@first.save!
begin
- Topic.transaction :requires_new => true do
+ Topic.transaction requires_new: true do
@first.content = "Four"
@first.save!
raise
@@ -508,7 +508,7 @@ class TransactionTest < ActiveRecord::TestCase
end
def test_rollback_when_saving_a_frozen_record
- topic = Topic.new(:title => "test")
+ topic = Topic.new(title: "test")
topic.freeze
e = assert_raise(RuntimeError) { topic.save }
assert_match(/frozen/i, e.message) # Not good enough, but we can't do much
@@ -552,9 +552,9 @@ class TransactionTest < ActiveRecord::TestCase
self.table_name = "topics"
end
- topic_1 = Topic.new(:title => "test_1")
- topic_2 = Topic.new(:title => "test_2")
- topic_3 = topic_without_callbacks.new(:title => "test_3")
+ topic_1 = Topic.new(title: "test_1")
+ topic_2 = Topic.new(title: "test_2")
+ topic_3 = topic_without_callbacks.new(title: "test_3")
Topic.transaction do
assert topic_1.save