Skip to content

Commit

Permalink
Fix a nil input bug in the wiki helper
Browse files Browse the repository at this point in the history
  • Loading branch information
eee-c committed Apr 9, 2009
1 parent 5c61f4c commit f3e534a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helpers.rb
Expand Up @@ -21,7 +21,7 @@ def recipe_category_link(recipe, category)
end

def wiki(original)
text = original.dup
text = (original || '').dup
text.gsub!(/\b(\d+)F/, "\\1° F")
text.gsub!(/\[kid:(\w+)\]/m) { |kid| kid_nicknames[$1] }
text.gsub!(/\[recipe:(\S+)\]/m) { |r| recipe_link($1) }
Expand Down
4 changes: 4 additions & 0 deletions spec/eee_helpers_spec.rb
Expand Up @@ -5,6 +5,10 @@
wiki("bob").should contain("bob")
end

it "should return an empty string if called with nil" do
wiki(nil).should == ""
end

it "should convert textile to HTML" do
textile = <<_TEXTILE
paragraph 1 *bold text*
Expand Down

0 comments on commit f3e534a

Please sign in to comment.