Commit 419a758b authored by Ash McKenzie's avatar Ash McKenzie

New repository_has_successfully_synced? method

parent 23d9ea0a
......@@ -432,6 +432,10 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
:synced
end
def repository_has_successfully_synced?
last_repository_successful_sync_at.present?
end
private
# Whether any operation has ever been attempted
......
......@@ -1014,4 +1014,22 @@ describe Geo::ProjectRegistry do
expect(registry.synchronization_state).to eq(:synced)
end
end
describe 'repository_has_successfully_synced?' do
context 'when repository has never successfully synced' do
it 'returns false' do
registry = create(:geo_project_registry, last_repository_successful_sync_at: nil)
expect(registry.repository_has_successfully_synced?).to be_falsey
end
end
context 'when repository has successfully synced' do
it 'returns true' do
registry = create(:geo_project_registry, last_repository_successful_sync_at: Time.now)
expect(registry.repository_has_successfully_synced?).to be_truthy
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