diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-31 21:38:00 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-31 21:38:00 +0300 |
commit | 0134079430f0179c527d388539c0986352bca9bd (patch) | |
tree | f4735de318c80d23670b55b12e03247ea6684337 /spec | |
parent | 85a677991073c5d21a33f43980b94402954efa11 (diff) | |
parent | 964cbb67da78dc89dbe32c113c5bee8f805d2784 (diff) |
Merge branch 'feature/migrate-find-wiki-page-to-gitaly' into 'master'
Migrate Gitlab::Git::Wiki#page to Gitaly
Closes gitaly#677
See merge request gitlab-org/gitlab-ce!14955
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 |