Add ProjectWiki#ensure_repository

parent 2a64607b
......@@ -149,6 +149,10 @@ def create_repo!
wiki
end
def ensure_repository
create_repo! unless repository_exists?
end
def hook_attrs
{
web_url: web_url,
......
......@@ -278,6 +278,24 @@
end
end
describe '#ensure_repository' do
it 'creates the repository if it not exist' do
allow(subject).to receive(:repository_exists?).and_return(false)
expect(subject).to receive(:create_repo!)
subject.ensure_repository
end
it 'does not create the repository if it exists' do
allow(subject).to receive(:repository_exists?).and_return(true)
expect(subject).not_to receive(:create_repo!)
subject.ensure_repository
end
end
describe '#hook_attrs' do
it 'returns a hash with values' do
expect(subject.hook_attrs).to be_a Hash
......
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