aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/dirty_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/test/cases/dirty_test.rb')
-rw-r--r--activemodel/test/cases/dirty_test.rb18
1 files changed, 2 insertions, 16 deletions
diff --git a/activemodel/test/cases/dirty_test.rb b/activemodel/test/cases/dirty_test.rb
index b120e68027..0edbbffa86 100644
--- a/activemodel/test/cases/dirty_test.rb
+++ b/activemodel/test/cases/dirty_test.rb
@@ -14,37 +14,23 @@ class DirtyTest < ActiveModel::TestCase
@status = "initialized"
end
- def name
- @name
- end
+ attr_reader :name, :color, :size, :status
def name=(val)
name_will_change!
@name = val
end
- def color
- @color
- end
-
def color=(val)
color_will_change! unless val == @color
@color = val
end
- def size
- @size
- end
-
def size=(val)
attribute_will_change!(:size) unless val == @size
@size = val
end
- def status
- @status
- end
-
def status=(val)
status_will_change! unless val == @status
@status = val
@@ -108,7 +94,7 @@ class DirtyTest < ActiveModel::TestCase
end
test "attribute mutation" do
- @model.instance_variable_set("@name", "Yam".dup)
+ @model.instance_variable_set("@name", +"Yam")
assert_not_predicate @model, :name_changed?
@model.name.replace("Hadad")
assert_not_predicate @model, :name_changed?