1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

Parse Time in tests with a numeric offset

Ruby's Time parser doesn't know named timezones and ignores them. By
specifying the actual offset, we get a valid time object.
This commit is contained in:
Holger Just 2017-02-02 17:43:39 +01:00
parent 407b52120a
commit 7bc351faae

View File

@ -322,14 +322,7 @@ describe Rackstash::Fields::AbstractCollection do
end
it 'formats Time as an ISO 8601 UTC timestamp' do
time = Time.parse('2016-10-17 15:37:42 CEST') # UTC +02:00
expect(normalize(time)).to eql '2016-10-17T13:37:42.000Z'
expect(normalize(time)).to be_frozen
end
it 'formats Time as an ISO 8601 UTC timestamp' do
time = Time.parse('2016-10-17 15:37:42 CEST') # UTC +02:00
time = Time.parse('2016-10-17 16:37:42 +03:00')
expect(normalize(time)).to eql '2016-10-17T13:37:42.000Z'
expect(normalize(time).encoding).to eql Encoding::UTF_8