Use the Geo::ProjectRegistry factory on geo_repository_worker_spec.rb

parent 380a7636
...@@ -20,19 +20,8 @@ describe GeoRepositorySyncWorker do ...@@ -20,19 +20,8 @@ describe GeoRepositorySyncWorker do
end end
it 'performs Geo::ProjectSyncWorker for projects where last attempt to sync failed' do it 'performs Geo::ProjectSyncWorker for projects where last attempt to sync failed' do
Geo::ProjectRegistry.create( create(:geo_project_registry, :sync_failed, project: project_1)
project: project_1, create(:geo_project_registry, :synced, project: project_2)
last_repository_synced_at: DateTime.now,
last_repository_successful_sync_at: nil
)
Geo::ProjectRegistry.create(
project: project_2,
last_repository_synced_at: DateTime.now,
last_repository_successful_sync_at: DateTime.now,
resync_repository: false,
resync_wiki: false
)
expect(Geo::ProjectSyncWorker).to receive(:perform_in).once.and_return(spy) expect(Geo::ProjectSyncWorker).to receive(:perform_in).once.and_return(spy)
...@@ -40,29 +29,9 @@ describe GeoRepositorySyncWorker do ...@@ -40,29 +29,9 @@ describe GeoRepositorySyncWorker do
end end
it 'performs Geo::ProjectSyncWorker for synced projects updated recently' do it 'performs Geo::ProjectSyncWorker for synced projects updated recently' do
Geo::ProjectRegistry.create( create(:geo_project_registry, :synced, :repository_dirty, project: project_1)
project: project_1, create(:geo_project_registry, :synced, project: project_2)
last_repository_synced_at: 2.days.ago, create(:geo_project_registry, :synced, :wiki_dirty)
last_repository_successful_sync_at: 2.days.ago,
resync_repository: true,
resync_wiki: false
)
Geo::ProjectRegistry.create(
project: project_2,
last_repository_synced_at: 10.minutes.ago,
last_repository_successful_sync_at: 10.minutes.ago,
resync_repository: false,
resync_wiki: false
)
Geo::ProjectRegistry.create(
project: create(:empty_project),
last_repository_synced_at: 5.minutes.ago,
last_repository_successful_sync_at: 5.minutes.ago,
resync_repository: false,
resync_wiki: true
)
expect(Geo::ProjectSyncWorker).to receive(:perform_in).twice.and_return(spy) expect(Geo::ProjectSyncWorker).to receive(:perform_in).twice.and_return(spy)
......
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