Fixed markdown tests

This commit is contained in:
randx 2012-08-08 11:52:09 +03:00
parent 6171a4d8eb
commit 04bad8257f
3 changed files with 18 additions and 18 deletions

View File

@ -42,21 +42,6 @@ module ApplicationHelper
grouped_options_for_select(options, @ref || @project.default_branch) grouped_options_for_select(options, @ref || @project.default_branch)
end end
def markdown(text)
@__renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::GitlabHTML.new(self, filter_html: true, with_toc_data: true), {
no_intra_emphasis: true,
tables: true,
fenced_code_blocks: true,
autolink: true,
strikethrough: true,
lax_html_blocks: true,
space_after_headers: true,
superscript: true
})
@__renderer.render(text).html_safe
end
def search_autocomplete_source def search_autocomplete_source
projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } } projects = current_user.projects.map{ |p| { :label => p.name, :url => project_path(p) } }
default_nav = [ default_nav = [

View File

@ -78,4 +78,19 @@ module GitlabMarkdownHelper
link_to(gfm_body.html_safe, url, html_options) link_to(gfm_body.html_safe, url, html_options)
end end
def markdown(text)
@__renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::GitlabHTML.new(self, filter_html: true, with_toc_data: true), {
no_intra_emphasis: true,
tables: true,
fenced_code_blocks: true,
autolink: true,
strikethrough: true,
lax_html_blocks: true,
space_after_headers: true,
superscript: true
})
@__renderer.render(text).html_safe
end
end end

View File

@ -1,6 +1,6 @@
require "spec_helper" require "spec_helper"
describe ApplicationHelper do describe GitlabMarkdownHelper do
before do before do
@project = Project.find_by_path("gitlabhq") || Factory(:project) @project = Project.find_by_path("gitlabhq") || Factory(:project)
@commit = @project.repo.commits.first.parents.first @commit = @project.repo.commits.first.parents.first
@ -10,10 +10,10 @@ describe ApplicationHelper do
end end
describe "#gfm" do describe "#gfm" do
it "should raiase an error if @project is not set" do it "should return text if @project is not set" do
@project = nil @project = nil
expect { gfm("foo") }.to raise_error gfm("foo").should == "foo"
end end
describe "referencing a commit" do describe "referencing a commit" do