Improve specs for Geo::ProjectRegistry failed and synced scopes

parent 91616f6a
......@@ -10,22 +10,10 @@ describe Geo::ProjectRegistry do
end
describe '.failed' do
let(:project) { create(:project) }
let(:synced_at) { Time.now }
it 'does not return synced projects' do
it 'returns projects where last attempt to sync failed' do
project = create(:project)
create(:geo_project_registry, :synced, project: project)
expect(described_class.failed).to be_empty
end
it 'does not return dirty projects' do
create(:geo_project_registry, :synced, :dirty, project: project)
expect(described_class.synced).to be_empty
end
it 'returns projects where last attempt to sync failed' do
repository_sync_failed = create(:geo_project_registry, :repository_sync_failed, project: project)
wiki_sync_failed = create(:geo_project_registry, :wiki_sync_failed, project: project)
......@@ -34,25 +22,13 @@ describe Geo::ProjectRegistry do
end
describe '.synced' do
let(:project) { create(:project) }
let(:synced_at) { Time.now }
it 'does not return dirty projects' do
it 'returns synced projects' do
project = create(:project)
create(:geo_project_registry, :synced, :dirty, project: project)
expect(described_class.synced).to be_empty
end
it 'does not return projects where last attempt to sync failed' do
create(:geo_project_registry, :sync_failed, project: project)
synced_project = create(:geo_project_registry, :synced, project: project)
expect(described_class.synced).to be_empty
end
it 'returns synced projects' do
registry = create(:geo_project_registry, :synced, project: project)
expect(described_class.synced).to match_array([registry])
expect(described_class.synced).to match_array([synced_project])
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