aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/serialized_attribute_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-08-26 03:03:12 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-08-26 03:56:19 -0300
commitb26f7a2517166eb432194dbbbcacc970391595e7 (patch)
tree16efdf430e44248f2a1e8bb98dec7211710c01f4 /activerecord/test/cases/serialized_attribute_test.rb
parent4f6120e0d58e73f410ba9834b52ecf0072423326 (diff)
downloadrails-b26f7a2517166eb432194dbbbcacc970391595e7.tar.gz
rails-b26f7a2517166eb432194dbbbcacc970391595e7.tar.bz2
rails-b26f7a2517166eb432194dbbbcacc970391595e7.zip
Use the Topic class in the attribute serialized tests
Diffstat (limited to 'activerecord/test/cases/serialized_attribute_test.rb')
-rw-r--r--activerecord/test/cases/serialized_attribute_test.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb
index 45e1fca42a..0a8b3ccd2e 100644
--- a/activerecord/test/cases/serialized_attribute_test.rb
+++ b/activerecord/test/cases/serialized_attribute_test.rb
@@ -54,11 +54,9 @@ class SerializedAttributeTest < ActiveRecord::TestCase
# is not really the value 'before type cast' so we should maybe think
# about changing that in the future.
def test_serialized_attribute_before_type_cast_returns_unserialized_value
- klass = Class.new(ActiveRecord::Base)
- klass.table_name = "topics"
- klass.serialize :content, Hash
+ Topic.serialize :content, Hash
- t = klass.new(:content => { :foo => :bar })
+ t = Topic.new(:content => { :foo => :bar })
assert_equal({ :foo => :bar }, t.content_before_type_cast)
t.save!
t.reload
@@ -66,11 +64,9 @@ class SerializedAttributeTest < ActiveRecord::TestCase
end
def test_serialized_attribute_calling_dup_method
- klass = Class.new(ActiveRecord::Base)
- klass.table_name = "topics"
- klass.serialize :content, JSON
+ Topic.serialize :content, JSON
- t = klass.new(:content => { :foo => :bar }).dup
+ t = Topic.new(:content => { :foo => :bar }).dup
assert_equal({ :foo => :bar }, t.content_before_type_cast)
end