Skip to content

Commit b8b50a9

Browse files
committed
Deal with activesupport time extensions
1 parent 46389aa commit b8b50a9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/dynflow/extensions/msgpack.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def to_msgpack(out = ''.dup)
1616
::MessagePack::DefaultFactory.register_type(0x00, Time, packer: MessagePack::Time::Packer, unpacker: MessagePack::Time::Unpacker)
1717

1818
begin
19+
# time_with_zone added a deprecation warning in 7.1.0 which we need to account for
20+
# it was removed again in 7.2.0
21+
require 'active_support/deprecation'
22+
require 'active_support/deprecator'
1923
require 'active_support/time_with_zone'
2024
unpacker = ->(payload) do
2125
tv = MessagePack::Timestamp.from_msgpack_ext(payload)

test/extensions_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# frozen_string_literal: true
22

33
require_relative 'test_helper'
4-
require 'active_support/time'
4+
require 'active_support/all'
55

66
module Dynflow
77
module ExtensionsTest
88
describe 'msgpack extensions' do
99
before do
10-
Thread.current[:time_zone] = ActiveSupport::TimeZone['Europe/Prague']
10+
Time.zone = ActiveSupport::TimeZone['Europe/Prague']
1111
end
12-
after { Thread.current[:time_zone] = nil }
12+
after { Time.zone = nil }
1313

1414
it 'allows {de,}serializing Time' do
1515
time = Time.now

0 commit comments

Comments
 (0)