Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/spec/lib/gitlab/git/wiki_spec.rb')
-rw-r--r--ruby/spec/lib/gitlab/git/wiki_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/ruby/spec/lib/gitlab/git/wiki_spec.rb b/ruby/spec/lib/gitlab/git/wiki_spec.rb
index aca0f0dee..9240ed62c 100644
--- a/ruby/spec/lib/gitlab/git/wiki_spec.rb
+++ b/ruby/spec/lib/gitlab/git/wiki_spec.rb
@@ -132,6 +132,38 @@ describe Gitlab::Git::Wiki do
end
end
+ describe '#gollum_wiki' do
+ context 'when repository is empty' do
+ it 'instantiates the gollum wiki with the repo symbolic ref' do
+ repository.rugged.head = 'refs/heads/foo'
+
+ expect(Gollum::Wiki).to receive(:new).with(repository.path, hash_including(ref: 'foo'))
+
+ subject.gollum_wiki
+ end
+ end
+
+ context 'when repository is not empty' do
+ let(:repository) { gitlab_git_from_gitaly(new_mutable_git_test_repo) }
+
+ it 'instantiates the gollum wiki with the repo root_ref' do
+ expect(Gollum::Wiki).to receive(:new).with(repository.path, hash_including(ref: repository.root_ref))
+
+ subject.gollum_wiki
+ end
+ end
+
+ context 'when symbolic ref and root ref cannot be found' do
+ it 'instantiates the gollum wiki without any ref' do
+ allow(subject).to receive(:gollum_default_ref).and_return(nil)
+
+ expect(Gollum::Wiki).to receive(:new).with(repository.path, {})
+
+ subject.gollum_wiki
+ end
+ end
+ end
+
def create_page(name, content)
subject.write_page(name, :markdown, content, commit_details(name))
end