Sha256: a307b004be00cd3b2034f5001c56ee2600157c1eb24a1551b86e0fa243cccd39

Contents?: true

Size: 1.26 KB

Versions: 14

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true
require_relative 'test_helper'
require 'active_support/time'

module Dynflow
  module ExtensionsTest
    describe 'msgpack extensions' do
      before do
        Thread.current[:time_zone] = ActiveSupport::TimeZone['Europe/Prague']
      end
      after { Thread.current[:time_zone] = nil }

      it 'allows {de,}serializing Time' do
        time = Time.now
        transformed = MessagePack.unpack(time.to_msgpack)
        assert_equal transformed, time
        assert_equal transformed.class, time.class
      end

      it 'allows {de,}serializing ActiveSupport::TimeWithZone' do
        time = Time.zone.now
        transformed = MessagePack.unpack(time.to_msgpack)
        assert_equal transformed, time
        assert_equal transformed.class, time.class
      end

      it 'allows {de,}serializing DateTime' do
        time = DateTime.now
        transformed = MessagePack.unpack(time.to_msgpack)
        assert_equal transformed, time
        assert_equal transformed.class, time.class
      end

      it 'allows {de,}serializing Date' do
        date = DateTime.current
        transformed = MessagePack.unpack(date.to_msgpack)
        assert_equal transformed, date
        assert_equal transformed.class, date.class
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dynflow-1.8.2 test/extensions_test.rb
dynflow-1.8.1 test/extensions_test.rb
dynflow-1.8.0 test/extensions_test.rb
dynflow-1.7.0 test/extensions_test.rb
dynflow-1.6.11 test/extensions_test.rb
dynflow-1.6.10 test/extensions_test.rb
dynflow-1.6.8 test/extensions_test.rb
dynflow-1.6.7 test/extensions_test.rb
dynflow-1.6.6 test/extensions_test.rb
dynflow-1.6.5 test/extensions_test.rb
dynflow-1.6.4 test/extensions_test.rb
dynflow-1.6.3 test/extensions_test.rb
dynflow-1.6.2 test/extensions_test.rb
dynflow-1.6.1 test/extensions_test.rb