Commit 04bad8257f1aec906e10576c425edcba3d9d8f90
1 parent
6171a4d8
Exists in
master
and in
4 other branches
Fixed markdown tests
Showing
3 changed files
with
18 additions
and
18 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -42,21 +42,6 @@ module ApplicationHelper | @@ -42,21 +42,6 @@ module ApplicationHelper | ||
42 | grouped_options_for_select(options, @ref || @project.default_branch) | 42 | grouped_options_for_select(options, @ref || @project.default_branch) |
43 | end | 43 | end |
44 | 44 | ||
45 | - def markdown(text) | ||
46 | - @__renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::GitlabHTML.new(self, filter_html: true, with_toc_data: true), { | ||
47 | - no_intra_emphasis: true, | ||
48 | - tables: true, | ||
49 | - fenced_code_blocks: true, | ||
50 | - autolink: true, | ||
51 | - strikethrough: true, | ||
52 | - lax_html_blocks: true, | ||
53 | - space_after_headers: true, | ||
54 | - superscript: true | ||
55 | - }) | ||
56 | - | ||
57 | - @__renderer.render(text).html_safe | ||
58 | - end | ||
59 | - | ||
60 | def search_autocomplete_source | 45 | def search_autocomplete_source |
61 | projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } } | 46 | projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } } |
62 | default_nav = [ | 47 | default_nav = [ |
app/helpers/gitlab_markdown_helper.rb
@@ -78,4 +78,19 @@ module GitlabMarkdownHelper | @@ -78,4 +78,19 @@ module GitlabMarkdownHelper | ||
78 | 78 | ||
79 | link_to(gfm_body.html_safe, url, html_options) | 79 | link_to(gfm_body.html_safe, url, html_options) |
80 | end | 80 | end |
81 | + | ||
82 | + def markdown(text) | ||
83 | + @__renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::GitlabHTML.new(self, filter_html: true, with_toc_data: true), { | ||
84 | + no_intra_emphasis: true, | ||
85 | + tables: true, | ||
86 | + fenced_code_blocks: true, | ||
87 | + autolink: true, | ||
88 | + strikethrough: true, | ||
89 | + lax_html_blocks: true, | ||
90 | + space_after_headers: true, | ||
91 | + superscript: true | ||
92 | + }) | ||
93 | + | ||
94 | + @__renderer.render(text).html_safe | ||
95 | + end | ||
81 | end | 96 | end |
spec/helpers/gitlab_flavored_markdown_spec.rb
1 | require "spec_helper" | 1 | require "spec_helper" |
2 | 2 | ||
3 | -describe ApplicationHelper do | 3 | +describe GitlabMarkdownHelper do |
4 | before do | 4 | before do |
5 | @project = Project.find_by_path("gitlabhq") || Factory(:project) | 5 | @project = Project.find_by_path("gitlabhq") || Factory(:project) |
6 | @commit = @project.repo.commits.first.parents.first | 6 | @commit = @project.repo.commits.first.parents.first |
@@ -10,10 +10,10 @@ describe ApplicationHelper do | @@ -10,10 +10,10 @@ describe ApplicationHelper do | ||
10 | end | 10 | end |
11 | 11 | ||
12 | describe "#gfm" do | 12 | describe "#gfm" do |
13 | - it "should raiase an error if @project is not set" do | 13 | + it "should return text if @project is not set" do |
14 | @project = nil | 14 | @project = nil |
15 | 15 | ||
16 | - expect { gfm("foo") }.to raise_error | 16 | + gfm("foo").should == "foo" |
17 | end | 17 | end |
18 | 18 | ||
19 | describe "referencing a commit" do | 19 | describe "referencing a commit" do |