From cf7ab6056adfd1d2feb98444d82f89adcb6e5533 Mon Sep 17 00:00:00 2001 From: Renato Mascarenhas Date: Sat, 1 Dec 2012 15:29:49 -0200 Subject: Reset attributes should not report changes. When resetting an attribute, you expect it to return to the state it was before any changes. Namely, this fixes this unexpected behavior: ~~~ruby model.name = "Bob" model.reset_name! model.name_changed? #=> true ~~~ --- activemodel/test/cases/dirty_test.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activemodel/test/cases') diff --git a/activemodel/test/cases/dirty_test.rb b/activemodel/test/cases/dirty_test.rb index eaaf910bac..0b9f9537e2 100644 --- a/activemodel/test/cases/dirty_test.rb +++ b/activemodel/test/cases/dirty_test.rb @@ -78,7 +78,7 @@ class DirtyTest < ActiveModel::TestCase @model.name = "Bob" @model.reset_name! assert_nil @model.name - #assert !@model.name_changed #Doesn't work yet + assert !@model.name_changed? end test "setting color to same value should not result in change being recorded" do @@ -114,5 +114,4 @@ class DirtyTest < ActiveModel::TestCase assert_equal ["Otto", "Mr. Manfredgensonton"], @model.name_change assert_equal @model.name_was, "Otto" end - end -- cgit v1.2.3