Commit 6ade2ca4 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '267990-wikifindpage-empty-title' into 'master'

Resolve "WikiFindPage: empty Title"

See merge request gitlab-org/gitlab!53863
parents c7a970b2 9062e315
...@@ -151,6 +151,8 @@ module Gitlab ...@@ -151,6 +151,8 @@ module Gitlab
end end
def gitaly_find_page(title:, version: nil, dir: nil) def gitaly_find_page(title:, version: nil, dir: nil)
return unless title.present?
wiki_page, version = gitaly_wiki_client.find_page(title: title, version: version, dir: dir) wiki_page, version = gitaly_wiki_client.find_page(title: title, version: version, dir: dir)
return unless wiki_page return unless wiki_page
......
...@@ -744,13 +744,19 @@ RSpec.describe Event do ...@@ -744,13 +744,19 @@ RSpec.describe Event do
describe '#wiki_page and #wiki_page?' do describe '#wiki_page and #wiki_page?' do
context 'for a wiki page event' do context 'for a wiki page event' do
let(:wiki_page) do let(:wiki_page) { create(:wiki_page, project: project) }
create(:wiki_page, project: project)
end
subject(:event) { create(:wiki_page_event, project: project, wiki_page: wiki_page) } subject(:event) { create(:wiki_page_event, project: project, wiki_page: wiki_page) }
it { is_expected.to have_attributes(wiki_page?: be_truthy, wiki_page: wiki_page) } it { is_expected.to have_attributes(wiki_page?: be_truthy, wiki_page: wiki_page) }
context 'title is empty' do
before do
expect(event.target).to receive(:canonical_slug).and_return('')
end
it { is_expected.to have_attributes(wiki_page?: be_truthy, wiki_page: nil) }
end
end end
context 'for any other event' do context 'for any other event' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment