Commit 7a24d526 authored by Alex Kalderimis's avatar Alex Kalderimis

Add test case for wiki pages without canonical slugs

This should never happen in the real-world. It represents a bug and a
failure of data-consistency.
parent 25bf63c8
...@@ -150,6 +150,21 @@ describe EventsHelper do ...@@ -150,6 +150,21 @@ describe EventsHelper do
expect(helper.event_wiki_page_target_url(event)).to eq(url) expect(helper.event_wiki_page_target_url(event)).to eq(url)
end end
context 'there is no canonical slug' do
let(:event) { create(:wiki_page_event, project: project) }
before do
event.target.slugs.update_all(canonical: false)
event.target.clear_memoization(:canonical_slug)
end
it 'links to the home page' do
url = helper.project_wiki_url(project, Wiki::HOMEPAGE)
expect(helper.event_wiki_page_target_url(event)).to eq(url)
end
end
end end
describe '#event_wiki_title_html' do describe '#event_wiki_title_html' 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