Sha256: 6e6454455752e559ae3f8e5290e714f03352cd61518e88eb3f10b5d09780983a
Contents?: true
Size: 845 Bytes
Versions: 1
Compression:
Stored size: 845 Bytes
Contents
require 'test_helper' class MsgpackSerializerTest < Test::Unit::TestCase def setup @person = Person.new @person.username = "Mittens the Cat" @person.age = 26 @person.joined_at = "January 4, 2011 2:34:17 PM".to_datetime.utc end def test_encode_all_encodable_attributes pck = @person.to_msgpack assert_match %r{username.Mittens the Cat}, pck assert_match %r{age#{MessagePack.pack(26)}}, pck assert_match %r{joined_at.#{Regexp.escape(@person.joined_at.utc.to_s)}}, pck end def test_encode_multiple_objects_in_array @person2 = Person.new(:username => "Gloves the Kitten", :age => 34, :joined_at => "February 3, 2010 6:44:00 AM".to_datetime.utc) pck = [@person, @person2].to_msgpack assert_match %r{username.Gloves the Kitten}, pck assert_match %r{username.Mittens the Cat}, pck end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
msgpack-rails-0.0.1 | test/msgpack_serializer_test.rb |