test(timespan): fix inconsistency between expectation and actual output

* Also added timecop to spec to avoid future breaks.
This commit is contained in:
Luis Castro 2019-08-02 11:22:30 +02:00
parent 0a9b944526
commit 5fe98ab464
No known key found for this signature in database
GPG key ID: 0A8F33D4C4E27639

View file

@ -38,7 +38,9 @@ describe Timespan do
describe '#create' do describe '#create' do
it 'returns the correct number of seconds constituting a timespan' do it 'returns the correct number of seconds constituting a timespan' do
expect(Timespan.create(1, 'month').to_i).to eq(2_592_000) Timecop.freeze(2018, 3, 25) do
expect(Timespan.create(1, 'month').to_i).to eq(2_629_746)
end
end end
it 'raises err when given an invalid time unit' do it 'raises err when given an invalid time unit' do