Avoid creating repository when calling Wiki#empty?

parent 057b01c1
......@@ -104,7 +104,7 @@ class Wiki
end
def empty?
list_pages(limit: 1).empty?
!repository_exists? || list_pages(limit: 1).empty?
end
def exists?
......
......@@ -154,6 +154,15 @@ RSpec.shared_examples 'wiki model' do
it 'returns true' do
expect(subject.empty?).to be(true)
end
context 'when the repository does not exist' do
let(:wiki_container) { wiki_container_without_repo }
it 'returns true and does not create the repo' do
expect(subject.empty?).to be(true)
expect(wiki.repository_exists?).to be false
end
end
end
context 'when the wiki has pages' do
......
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