Commit b9c19e2f authored by John Cai's avatar John Cai

Adding convenience method to project model

parent bac1f72c
......@@ -2073,6 +2073,10 @@ class Project < ActiveRecord::Base
pool_repository&.link_repository(repository)
end
def has_pool_repository?
pool_repository.present?
end
private
def merge_requests_allowing_collaboration(source_branch = nil)
......
......@@ -4602,6 +4602,21 @@ describe Project do
end
end
describe '#has_pool_repsitory?' do
it 'returns false when it does not have a pool repository' do
subject = create(:project, :repository)
expect(subject.has_pool_repository?).to be false
end
it 'returns true when it has a pool repository' do
pool = create(:pool_repository, :ready)
subject = create(:project, :repository, pool_repository: pool)
expect(subject.has_pool_repository?).to be true
end
end
def rugged_config
rugged_repo(project.repository).config
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