Refactor Geo::ProjectRegistry spec

parent 751d0cba
...@@ -14,43 +14,19 @@ describe Geo::ProjectRegistry, models: true do ...@@ -14,43 +14,19 @@ describe Geo::ProjectRegistry, models: true do
let(:synced_at) { Time.now } let(:synced_at) { Time.now }
it 'does not return dirty projects' do it 'does not return dirty projects' do
Geo::ProjectRegistry.create( create(:geo_project_registry, :synced, :dirty, project: project)
project: project,
last_repository_synced_at: synced_at,
last_repository_successful_sync_at: synced_at,
last_wiki_synced_at: synced_at,
last_wiki_successful_sync_at: synced_at,
resync_repository: true,
resync_wiki: true
)
expect(described_class.synced).to be_empty expect(described_class.synced).to be_empty
end end
it 'does not return projects where last attempt to sync failed' do it 'does not return projects where last attempt to sync failed' do
Geo::ProjectRegistry.create( create(:geo_project_registry, :sync_failed, project: project)
project: project,
last_repository_synced_at: synced_at,
last_repository_successful_sync_at: nil,
last_wiki_synced_at: synced_at,
last_wiki_successful_sync_at: nil,
resync_repository: true,
resync_wiki: true
)
expect(described_class.synced).to be_empty expect(described_class.synced).to be_empty
end end
it 'returns synced projects' do it 'returns synced projects' do
registry = Geo::ProjectRegistry.create( registry = create(:geo_project_registry, :synced, project: project)
project: project,
last_repository_synced_at: synced_at,
last_repository_successful_sync_at: synced_at,
last_wiki_synced_at: synced_at,
last_wiki_successful_sync_at: synced_at,
resync_repository: false,
resync_wiki: false
)
expect(described_class.synced).to match_array([registry]) expect(described_class.synced).to match_array([registry])
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