diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2017-10-19 16:18:26 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2017-10-31 18:28:54 +0200 |
commit | 964cbb67da78dc89dbe32c113c5bee8f805d2784 (patch) | |
tree | b9112b3ea3a61fb39d5f24c370a7f69b65e4271d /spec | |
parent | bd33a8290a34048b90818280edeb4e597de8a6ed (diff) | |
download | gitlab-ce-964cbb67da78dc89dbe32c113c5bee8f805d2784.tar.gz |
Migrate Gitlab::Git::Wiki#page to Gitalyfeature/migrate-find-wiki-page-to-gitaly
Closes gitaly#677
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/project_wiki_spec.rb | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb index 95d58b96f33..52a2b4b2850 100644 --- a/spec/models/project_wiki_spec.rb +++ b/spec/models/project_wiki_spec.rb @@ -117,31 +117,41 @@ describe ProjectWiki do end describe "#find_page" do - before do - create_page("index page", "This is an awesome Gollum Wiki") - end + shared_examples 'finding a wiki page' do + before do + create_page("index page", "This is an awesome Gollum Wiki") + end - after do - destroy_page(subject.pages.first.page) - end + after do + destroy_page(subject.pages.first.page) + end - it "returns the latest version of the page if it exists" do - page = subject.find_page("index page") - expect(page.title).to eq("index page") - end + it "returns the latest version of the page if it exists" do + page = subject.find_page("index page") + expect(page.title).to eq("index page") + end + + it "returns nil if the page does not exist" do + expect(subject.find_page("non-existant")).to eq(nil) + end + + it "can find a page by slug" do + page = subject.find_page("index-page") + expect(page.title).to eq("index page") + end - it "returns nil if the page does not exist" do - expect(subject.find_page("non-existant")).to eq(nil) + it "returns a WikiPage instance" do + page = subject.find_page("index page") + expect(page).to be_a WikiPage + end end - it "can find a page by slug" do - page = subject.find_page("index-page") - expect(page.title).to eq("index page") + context 'when Gitaly wiki_find_page is enabled' do + it_behaves_like 'finding a wiki page' end - it "returns a WikiPage instance" do - page = subject.find_page("index page") - expect(page).to be_a WikiPage + context 'when Gitaly wiki_find_page is disabled', :skip_gitaly_mock do + it_behaves_like 'finding a wiki page' end end |