mirror of
https://github.com/meineerde/rackstash.git
synced 2026-04-06 23:21:40 +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:
parent
407b52120a
commit
7bc351faae
@ -322,14 +322,7 @@ describe Rackstash::Fields::AbstractCollection do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'formats Time as an ISO 8601 UTC timestamp' do
|
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)).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
|
|
||||||
|
|
||||||
expect(normalize(time)).to eql '2016-10-17T13:37:42.000Z'
|
expect(normalize(time)).to eql '2016-10-17T13:37:42.000Z'
|
||||||
expect(normalize(time).encoding).to eql Encoding::UTF_8
|
expect(normalize(time).encoding).to eql Encoding::UTF_8
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user