X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Factiverecord%2Ftest%2Fcases%2Fserialization_test.rb;fp=vendor%2Frails%2Factiverecord%2Ftest%2Fcases%2Fserialization_test.rb;h=0000000000000000000000000000000000000000;hb=36d9f3351a3b4e8159279445190e2287ffdea86c;hp=88416942717d2b1d98b9258e704637d9586f3389;hpb=913cf6054b1d29b5d2f5e620304af7ee77cc1f1f;p=feedcatcher.git diff --git a/vendor/rails/activerecord/test/cases/serialization_test.rb b/vendor/rails/activerecord/test/cases/serialization_test.rb deleted file mode 100644 index 8841694..0000000 --- a/vendor/rails/activerecord/test/cases/serialization_test.rb +++ /dev/null @@ -1,47 +0,0 @@ -require "cases/helper" -require 'models/contact' - -class SerializationTest < ActiveRecord::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 => 'ruby' } - } - - @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