Improve specs for Geo::ProjectRegistry failed and synced scopes

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