Permalink
Browse files

Use the Topic class in the attribute serialized tests

  • Loading branch information...
1 parent 4f6120e commit b26f7a2517166eb432194dbbbcacc970391595e7 @rafaelfranca rafaelfranca committed Aug 26, 2012
Showing with 4 additions and 8 deletions.
  1. +4 −8 activerecord/test/cases/serialized_attribute_test.rb
@@ -54,23 +54,19 @@ def test_serialized_attribute_in_base_class
# 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
assert_equal({ :foo => :bar }, t.content_before_type_cast)
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

0 comments on commit b26f7a2

Please sign in to comment.