Commit 461abaa843b5c21a5103fde802db770dd583ac92
1 parent
7af1bc3b
Exists in
master
and in
4 other branches
Add GollumWiki#empty? method
Showing
2 changed files
with
25 additions
and
0 deletions
Show diff stats
app/models/gollum_wiki.rb
spec/models/gollum_wiki_spec.rb
... | ... | @@ -86,6 +86,27 @@ describe GollumWiki do |
86 | 86 | end |
87 | 87 | end |
88 | 88 | |
89 | + describe "#empty?" do | |
90 | + context "when the wiki repository is empty" do | |
91 | + before do | |
92 | + Gitlab::Shell.any_instance.stub(:add_repository) do | |
93 | + create_temp_repo("#{Rails.root}/tmp/test-git-base-path/non-existant.wiki.git") | |
94 | + end | |
95 | + project.stub(:path_with_namespace).and_return("non-existant") | |
96 | + end | |
97 | + | |
98 | + its(:empty?) { should be_true } | |
99 | + end | |
100 | + | |
101 | + context "when the wiki has pages" do | |
102 | + before do | |
103 | + create_page("index", "This is an awesome new Gollum Wiki") | |
104 | + end | |
105 | + | |
106 | + its(:empty?) { should be_false } | |
107 | + end | |
108 | + end | |
109 | + | |
89 | 110 | describe "#pages" do |
90 | 111 | before do |
91 | 112 | create_page("index", "This is an awesome new Gollum Wiki") | ... | ... |