Commit 6f9428b1cd66d9f4ded1f1b1ef38e258e2b97c50

Authored by Riyad Preukschas
1 parent 90c2cd1e

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

app/helpers/application_helper.rb
... ... @@ -44,6 +44,7 @@ module ApplicationHelper
44 44  
45 45 def gfm(text, html_options = {})
46 46 return text if text.nil?
  47 + raise "@project is not set" if @project.nil?
47 48  
48 49 # Extract pre blocks
49 50 # from http://github.github.com/github-flavored-markdown/
... ...
spec/helpers/gitlab_flavored_markdown_spec.rb
... ... @@ -10,6 +10,12 @@ describe ApplicationHelper do
10 10 end
11 11  
12 12 describe "#gfm" do
  13 + it "should raiase an error if @project is not set" do
  14 + @project = nil
  15 +
  16 + expect { gfm("foo") }.to raise_error
  17 + end
  18 +
13 19 describe "referencing a commit" do
14 20 it "should link using a full id" do
15 21 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 "}"
... ...