summaryrefslogtreecommitdiff
path: root/spec/models/wiki_page_spec.rb
diff options
context:
space:
mode:
authorLuke Duncalfe <lduncalfe@eml.cc>2019-10-03 17:01:57 +1300
committerLuke Duncalfe <lduncalfe@eml.cc>2019-10-23 11:42:37 +1300
commit49a78d419d2379b06fd917173717a9fe8174697a (patch)
tree80b79a5457193c82696c076437b5d36e881ff214 /spec/models/wiki_page_spec.rb
parentd5e0416021aa6de53b89f9d415f368226d9326e5 (diff)
downloadgitlab-ce-49a78d419d2379b06fd917173717a9fe8174697a.tar.gz
Pass all wiki markup formats through pipelines
Previously, when the wiki page format was anything other than `markdown` or `asciidoc` the formatted content would be returned though a Gitaly call. Gitaly in turn would delegate formatting to the gitlab-gollum-lib gem, which in turn would delegate that to various gems (like RDoc for `rdoc`) and then apply some very liberal sanitization. It was too liberal! This change brings our wiki content formatting in line with how we format other markdown at GitLab, so we have a SSOT for sanitization. https://gitlab.com/gitlab-org/gitlab/issues/30540
Diffstat (limited to 'spec/models/wiki_page_spec.rb')
-rw-r--r--spec/models/wiki_page_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index 18c62c917dc..9014276dcf8 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -439,6 +439,23 @@ describe WikiPage do
end
end
+ describe '#path' do
+ let(:path) { 'mypath.md' }
+ let(:wiki_page) { instance_double('Gitlab::Git::WikiPage', path: path).as_null_object }
+
+ it 'returns the path when persisted' do
+ page = described_class.new(wiki, wiki_page, true)
+
+ expect(page.path).to eq(path)
+ end
+
+ it 'returns nil when not persisted' do
+ page = described_class.new(wiki, wiki_page, false)
+
+ expect(page.path).to be_nil
+ end
+ end
+
describe '#directory' do
context 'when the page is at the root directory' do
it 'returns an empty string' do