Sha256: 6663c90ea3e2337f9a3184a0dfb6faece9b531d60bbdb46fffbd4b5ad583bd48

Contents?: true

Size: 800 Bytes

Versions: 2

Compression:

Stored size: 800 Bytes

Contents

require_relative "../test_helper"

class TestMessagePackEncoding < Test::Unit::TestCase
  def test_decoding
    [Time.now, [Date.new], {:foo => DateTime.new}].each do |data|
      assert_equal data.as_json, ActiveSupport::MessagePack.decode(ActiveSupport::MessagePack.encode(data))
    end

    ActiveSupport.parse_msgpack_times = true

    date = DateTime.parse(DateTime.now.as_json)

    test_data = date
    assert_equal test_data, ActiveSupport::MessagePack.decode(ActiveSupport::MessagePack.encode(test_data))

    test_data = [date]
    assert_equal test_data, ActiveSupport::MessagePack.decode(ActiveSupport::MessagePack.encode(test_data))

    test_data = { "foo" => date }
    assert_equal test_data, ActiveSupport::MessagePack.decode(ActiveSupport::MessagePack.encode(test_data))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
msgpack_rails-0.3.0 test/msgpack_rails/decoding_test.rb
msgpack_rails-0.1.0 test/msgpack_rails/decoding_test.rb