aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/serialization_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-01-18 07:30:42 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-01-18 07:30:42 +0000
commit42b39ae3f2991692672364d7e09b1e4002e66261 (patch)
treecddaf1eb2dbf7be27430bde882432db3b1cc0407 /activerecord/test/serialization_test.rb
parent105a27f39ee9dbfd7fdb2b25e5ba38b00708b66c (diff)
downloadrails-42b39ae3f2991692672364d7e09b1e4002e66261.tar.gz
rails-42b39ae3f2991692672364d7e09b1e4002e66261.tar.bz2
rails-42b39ae3f2991692672364d7e09b1e4002e66261.zip
Move tests to cases
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/serialization_test.rb')
-rw-r--r--activerecord/test/serialization_test.rb47
1 files changed, 0 insertions, 47 deletions
diff --git a/activerecord/test/serialization_test.rb b/activerecord/test/serialization_test.rb
deleted file mode 100644
index 61756999ed..0000000000
--- a/activerecord/test/serialization_test.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'abstract_unit'
-require 'fixtures/contact'
-
-class SerializationTest < ActiveSupport::TestCase
- FORMATS = [ :xml, :json ]
-
- def setup
- @contact_attributes = {
- :name => 'aaron stack',
- :age => 25,
- :avatar => 'binarydata',
- :created_at => Time.utc(2006, 8, 1),
- :awesome => false,
- :preferences => { :gem => '<strong>ruby</strong>' }
- }
-
- @contact = Contact.new(@contact_attributes)
- end
-
- def test_serialize_should_be_reversible
- for format in FORMATS
- @serialized = Contact.new.send("to_#{format}")
- contact = Contact.new.send("from_#{format}", @serialized)
-
- assert_equal @contact_attributes.keys.collect(&:to_s).sort, contact.attributes.keys.collect(&:to_s).sort, "For #{format}"
- end
- end
-
- def test_serialize_should_allow_attribute_only_filtering
- for format in FORMATS
- @serialized = Contact.new(@contact_attributes).send("to_#{format}", :only => [ :age, :name ])
- contact = Contact.new.send("from_#{format}", @serialized)
- assert_equal @contact_attributes[:name], contact.name, "For #{format}"
- assert_nil contact.avatar, "For #{format}"
- end
- end
-
- def test_serialize_should_allow_attribute_except_filtering
- for format in FORMATS
- @serialized = Contact.new(@contact_attributes).send("to_#{format}", :except => [ :age, :name ])
- contact = Contact.new.send("from_#{format}", @serialized)
- assert_nil contact.name, "For #{format}"
- assert_nil contact.age, "For #{format}"
- assert_equal @contact_attributes[:awesome], contact.awesome, "For #{format}"
- end
- end
-end \ No newline at end of file