Commit 42c7be1e authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'jc-add-has-repository' into 'master'

Adding convenience method to project model

See merge request gitlab-org/gitlab-ce!25108
parents ce919208 b9c19e2f
...@@ -2073,6 +2073,10 @@ class Project < ActiveRecord::Base ...@@ -2073,6 +2073,10 @@ class Project < ActiveRecord::Base
pool_repository&.link_repository(repository) pool_repository&.link_repository(repository)
end end
def has_pool_repository?
pool_repository.present?
end
private private
def merge_requests_allowing_collaboration(source_branch = nil) def merge_requests_allowing_collaboration(source_branch = nil)
......
...@@ -4602,6 +4602,21 @@ describe Project do ...@@ -4602,6 +4602,21 @@ describe Project do
end end
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 def rugged_config
rugged_repo(project.repository).config rugged_repo(project.repository).config
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