Commit 6f9428b1 authored by Riyad Preukschas's avatar Riyad Preukschas

Fix GFM helper to raise an exception when @project is not set

parent 90c2cd1e
......@@ -44,6 +44,7 @@ module ApplicationHelper
def gfm(text, html_options = {})
return text if text.nil?
raise "@project is not set" if @project.nil?
# Extract pre blocks
# from http://github.github.com/github-flavored-markdown/
......
......@@ -10,6 +10,12 @@ describe ApplicationHelper do
end
describe "#gfm" do
it "should raiase an error if @project is not set" do
@project = nil
expect { gfm("foo") }.to raise_error
end
describe "referencing a commit" do
it "should link using a full id" do
gfm("Reverts changes from #{@commit.id}").should == "Reverts changes from #{link_to @commit.id, project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "}"
......
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