diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2018-01-24 17:52:44 +0100 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2018-01-24 19:03:10 +0100 |
commit | c237c16eead776b3d64899a7a3a32e1f050e8998 (patch) | |
tree | 5819c9821b2984b21c6c2d58d7d74712d24569c5 | |
parent | a403011e4f7adae339a3a8584e22a75f4872c3c5 (diff) | |
download | gitlab-ce-fix/add-formatted-data-to-wiki-page.tar.gz |
Add formatted_data attribute to Git::WikiPagefix/add-formatted-data-to-wiki-page
Related to #39805
-rw-r--r-- | lib/gitlab/git/wiki_page.rb | 3 | ||||
-rw-r--r-- | spec/models/wiki_page_spec.rb | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/gitlab/git/wiki_page.rb b/lib/gitlab/git/wiki_page.rb index a06bac4414f..538fadcb189 100644 --- a/lib/gitlab/git/wiki_page.rb +++ b/lib/gitlab/git/wiki_page.rb @@ -1,7 +1,7 @@ module Gitlab module Git class WikiPage - attr_reader :url_path, :title, :format, :path, :version, :raw_data, :name, :text_data, :historical + attr_reader :url_path, :title, :format, :path, :version, :raw_data, :name, :text_data, :historical, :formatted_data # This class is meant to be serializable so that it can be constructed # by Gitaly and sent over the network to GitLab. @@ -21,6 +21,7 @@ module Gitlab @raw_data = gollum_page.raw_data @name = gollum_page.name @historical = gollum_page.historical? + @formatted_data = gollum_page.formatted_data @version = version end diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index ea75434e399..c6d1fed087c 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -386,6 +386,19 @@ describe WikiPage do end end + describe '#formatted_content' do + after do + destroy_page('RDoc') + end + + it 'returns processed content of the page', :disable_gitaly do + subject.create({ title: "RDoc", content: "*bold*", format: "rdoc" }) + page = wiki.find_page('RDoc') + + expect(page.formatted_content).to eq("\n<p><strong>bold</strong></p>\n") + end + end + private def remove_temp_repo(path) |