Commit 0a1f4440 authored by Jasper Maes's avatar Jasper Maes

Rails5: fix mysql milliseconds problem in project_spec

parent 23e63d66
---
title: 'Rails5: fix mysql milliseconds problem in project_spec'
merge_request: 6880
author: Jasper Maes
type: fixed
...@@ -60,7 +60,7 @@ describe Project do ...@@ -60,7 +60,7 @@ describe Project do
project.save project.save
end.to change { ProjectImportState.count }.by(1) end.to change { ProjectImportState.count }.by(1)
expect(project.import_state.next_execution_timestamp).to eq(Time.now) expect(project.import_state.next_execution_timestamp).to be_like_time(Time.now)
end end
end end
end end
...@@ -75,7 +75,7 @@ describe Project do ...@@ -75,7 +75,7 @@ describe Project do
project.update(mirror: true, mirror_user_id: project.creator.id, import_url: generate(:url)) project.update(mirror: true, mirror_user_id: project.creator.id, import_url: generate(:url))
end.to change { ProjectImportState.count }.by(1) end.to change { ProjectImportState.count }.by(1)
expect(project.import_state.next_execution_timestamp).to eq(Time.now) expect(project.import_state.next_execution_timestamp).to be_like_time(Time.now)
end end
end end
end end
...@@ -89,7 +89,7 @@ describe Project do ...@@ -89,7 +89,7 @@ describe Project do
project.update(mirror: true, mirror_user_id: project.creator.id) project.update(mirror: true, mirror_user_id: project.creator.id)
end.not_to change { ProjectImportState.count } end.not_to change { ProjectImportState.count }
expect(project.import_state.next_execution_timestamp).to eq(Time.now) expect(project.import_state.next_execution_timestamp).to be_like_time(Time.now)
end end
end end
end end
...@@ -377,7 +377,7 @@ describe Project do ...@@ -377,7 +377,7 @@ describe Project do
describe '#force_import_job!' do describe '#force_import_job!' do
it 'sets next execution timestamp to now and schedules UpdateAllMirrorsWorker' do it 'sets next execution timestamp to now and schedules UpdateAllMirrorsWorker' do
timestamp = Time.now timestamp = 1.second.from_now.change(usec: 0)
project = create(:project, :mirror) project = create(:project, :mirror)
expect(UpdateAllMirrorsWorker).to receive(:perform_async) expect(UpdateAllMirrorsWorker).to receive(:perform_async)
...@@ -396,7 +396,7 @@ describe Project do ...@@ -396,7 +396,7 @@ describe Project do
Timecop.freeze(timestamp) do Timecop.freeze(timestamp) do
expect { project.force_import_job! }.to change(project.import_state, :retry_count).to(0) expect { project.force_import_job! }.to change(project.import_state, :retry_count).to(0)
expect(project.import_state.next_execution_timestamp).to eq(timestamp) expect(project.import_state.next_execution_timestamp).to be_like_time(timestamp)
end end
end end
end 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