Commit e323681a authored by Stan Hu's avatar Stan Hu Committed by Rémy Coutable

Fix intermittent spec failure in spec/lib/gitlab/mirror_spec.rb

If you attempt to run this spec between 00:00 and 01:00, one of
the examples fails because:

DateTime.now.beginning_of_hour == DateTime.now.at_beginning_of_day

Closes #2081
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 42c9bde5
......@@ -256,14 +256,14 @@ describe Gitlab::Mirror do
expect(Gitlab::Mirror.at_beginning_of_day?).to be true
end
it 'returns false if at beginning of hour' do
Timecop.freeze(DateTime.now.beginning_of_hour)
it 'returns true during the first 14 minutes of the day' do
Timecop.freeze(DateTime.now.beginning_of_day + 14.minutes)
expect(Gitlab::Mirror.at_beginning_of_day?).to be false
expect(Gitlab::Mirror.at_beginning_of_day?).to be true
end
it 'returns false in every 15 minute mark' do
Timecop.freeze(DateTime.now.beginning_of_hour + 15.minutes)
it 'returns false if some time after the day started' do
Timecop.freeze(DateTime.now.midday)
expect(Gitlab::Mirror.at_beginning_of_day?).to be false
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment