Skip to content

Commit

Permalink
Add "strip" specs for Fugit.parse_duration, gh-74
Browse files Browse the repository at this point in the history
  • Loading branch information
jmettraux committed Aug 23, 2022
1 parent e3acdd9 commit 6025fb0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spec/cron_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,9 @@ class Fugit::Cron::TimeCursor
end
end
end
end

describe Fugit do

describe '#parse_cron' do

Expand Down
17 changes: 17 additions & 0 deletions spec/duration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,23 @@
end
end

[

[ "7d7", 7 * 24 * 3600 + 7 ],
[ " 7d7\n \n", 7 * 24 * 3600 + 7 ],
[ " 7d 7\n \n", 7 * 24 * 3600 + 7 ],

].each do |src, sec|

it "strips and parses #{src.inspect}" do

d = Fugit::Duration.parse(src)

expect(d.original).to eq(src)
expect(d.to_sec).to eq(sec)
end
end

it 'rejects lower case when ISO and :stricter' do

expect(
Expand Down

0 comments on commit 6025fb0

Please sign in to comment.