Skip to content

Commit

Permalink
Add "strip" specs for Fugit.parse_at, gh-74
Browse files Browse the repository at this point in the history
  • Loading branch information
jmettraux committed Aug 23, 2022
1 parent 2d14673 commit dd614c8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion spec/at_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
expect(t.object_id).to eq(eot.object_id)
end

it 'strips before parsing' do

t = Fugit.parse_at(" 2017-01-03 11:21:17\n ")

expect(Fugit.time_to_plain_s(t, false)).to eq('2017-01-03 11:21:17')
end

context 'with timezones' do

[
Expand All @@ -39,9 +46,14 @@
[ '2018-09-04 06:41:34 Etc/GMT-11', '2018-09-04 06:41:34 +11 +1100' ],
#[ '2018-09-04 06:41:34 UTC+11', nil ],

[ "\n2018-09-04 06:41:34 +11:00",
'2018-09-04 06:41:34 +11:00 +1100' ],
[ " \n 2018-09-04 06:41:34 Etc/GMT-11",
'2018-09-04 06:41:34 +11 +1100' ],

].each do |string, plain|

it "parses #{string}" do
it "parses #{string.inspect}" do

t = Fugit.parse_at(string)

Expand Down

0 comments on commit dd614c8

Please sign in to comment.