Avoid creating repository when calling Wiki#empty?

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