aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/timestamp_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/timestamp_test.rb')
-rw-r--r--activerecord/test/cases/timestamp_test.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb
index 401439994d..597b954d84 100644
--- a/activerecord/test/cases/timestamp_test.rb
+++ b/activerecord/test/cases/timestamp_test.rb
@@ -15,21 +15,21 @@ class TimestampTest < ActiveRecord::TestCase
def test_saving_a_changed_record_updates_its_timestamp
@developer.name = "Jack Bauer"
@developer.save!
-
+
assert_not_equal @previously_updated_at, @developer.updated_at
end
-
+
def test_saving_a_unchanged_record_doesnt_update_its_timestamp
@developer.save!
-
+
assert_equal @previously_updated_at, @developer.updated_at
end
-
+
def test_touching_a_record_updates_its_timestamp
previous_salary = @developer.salary
@developer.salary = previous_salary + 10000
@developer.touch
-
+
assert_not_equal @previously_updated_at, @developer.updated_at
assert_equal previous_salary + 10000, @developer.salary
assert @developer.salary_changed?, 'developer salary should have changed'
@@ -37,7 +37,7 @@ class TimestampTest < ActiveRecord::TestCase
@developer.reload
assert_equal previous_salary, @developer.salary
end
-
+
def test_touching_a_different_attribute
previously_created_at = @developer.created_at
@developer.touch(:created_at)
@@ -47,15 +47,15 @@ class TimestampTest < ActiveRecord::TestCase
assert_not_equal previously_created_at, @developer.created_at
assert_not_equal @previously_updated_at, @developer.updated_at
end
-
+
def test_saving_a_record_with_a_belongs_to_that_specifies_touching_the_parent_should_update_the_parent_updated_at
pet = Pet.first
owner = pet.owner
previously_owner_updated_at = owner.updated_at
-
+
pet.name = "Fluffy the Third"
pet.save
-
+
assert_not_equal previously_owner_updated_at, pet.owner.updated_at
end
@@ -63,22 +63,22 @@ class TimestampTest < ActiveRecord::TestCase
pet = Pet.first
owner = pet.owner
previously_owner_updated_at = owner.updated_at
-
+
pet.destroy
-
+
assert_not_equal previously_owner_updated_at, pet.owner.updated_at
end
-
+
def test_saving_a_record_with_a_belongs_to_that_specifies_touching_a_specific_attribute_the_parent_should_update_that_attribute
Pet.belongs_to :owner, :touch => :happy_at
pet = Pet.first
owner = pet.owner
previously_owner_happy_at = owner.happy_at
-
+
pet.name = "Fluffy the Third"
pet.save
-
+
assert_not_equal previously_owner_happy_at, pet.owner.happy_at
ensure
Pet.belongs_to :owner, :touch => true