Sha256: 8f933657c12b1764ba6d9b524c7c8f0909131413df4a13379ade8ce53ce2e51e

Contents?: true

Size: 794 Bytes

Versions: 4

Compression:

Stored size: 794 Bytes

Contents

require_relative "../test_helper"

class TestMessagePackEncoding < Minitest::Test
  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

4 entries across 4 versions & 1 rubygems

Version Path
msgpack_rails-0.4.3 test/msgpack_rails/decoding_test.rb
msgpack_rails-0.4.2 test/msgpack_rails/decoding_test.rb
msgpack_rails-0.4.1 test/msgpack_rails/decoding_test.rb
msgpack_rails-0.4.0 test/msgpack_rails/decoding_test.rb