summaryrefslogtreecommitdiff
path: root/spec/helpers/wiki_helper_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-02 15:09:08 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-02 15:09:08 +0000
commit840d5ecdbbf8da3e03a7f0b8b465a89d1519807c (patch)
tree4e197815c026a947057f7b5cbcb5e3cf106cc22f /spec/helpers/wiki_helper_spec.rb
parentb0107e8756bf3287f8a6221252c800209a9c46f6 (diff)
downloadgitlab-ce-840d5ecdbbf8da3e03a7f0b8b465a89d1519807c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/wiki_helper_spec.rb')
-rw-r--r--spec/helpers/wiki_helper_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/helpers/wiki_helper_spec.rb b/spec/helpers/wiki_helper_spec.rb
index f4eb3e53f80..a2c4f02278d 100644
--- a/spec/helpers/wiki_helper_spec.rb
+++ b/spec/helpers/wiki_helper_spec.rb
@@ -3,6 +3,38 @@
require 'spec_helper'
RSpec.describe WikiHelper do
+ describe '#wiki_page_title' do
+ let_it_be(:page) { create(:wiki_page) }
+
+ it 'sets the title for the show action' do
+ expect(helper).to receive(:breadcrumb_title).with(page.human_title)
+ expect(helper).to receive(:wiki_breadcrumb_dropdown_links).with(page.slug)
+ expect(helper).to receive(:page_title).with(page.human_title, 'Wiki')
+ expect(helper).to receive(:add_to_breadcrumbs).with('Wiki', helper.wiki_path(page.wiki))
+
+ helper.wiki_page_title(page)
+ end
+
+ it 'sets the title for a custom action' do
+ expect(helper).to receive(:breadcrumb_title).with(page.human_title)
+ expect(helper).to receive(:wiki_breadcrumb_dropdown_links).with(page.slug)
+ expect(helper).to receive(:page_title).with('Edit', page.human_title, 'Wiki')
+ expect(helper).to receive(:add_to_breadcrumbs).with('Wiki', helper.wiki_path(page.wiki))
+
+ helper.wiki_page_title(page, 'Edit')
+ end
+
+ it 'sets the title for an unsaved page' do
+ expect(page).to receive(:persisted?).and_return(false)
+ expect(helper).not_to receive(:breadcrumb_title)
+ expect(helper).not_to receive(:wiki_breadcrumb_dropdown_links)
+ expect(helper).to receive(:page_title).with('Wiki')
+ expect(helper).to receive(:add_to_breadcrumbs).with('Wiki', helper.wiki_path(page.wiki))
+
+ helper.wiki_page_title(page)
+ end
+ end
+
describe '#breadcrumb' do
context 'when the page is at the root level' do
it 'returns the capitalized page name' do