]> source.dussan.org Git - redmine.git/commitdiff
Merged r3446 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 28 Feb 2010 09:56:55 +0000 (09:56 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 28 Feb 2010 09:56:55 +0000 (09:56 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3502 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/wiki_formatting.rb
test/unit/lib/redmine/wiki_formatting.rb

index f33ef9e6d223b65a1cf0124c30621aa69d5524ba..3190d8d4d62e9171ad4c9859b08d319df56a8d2e 100644 (file)
@@ -25,17 +25,17 @@ module Redmine
       end
       
       def register(name, formatter, helper)
-        raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name.to_sym]
-        @@formatters[name.to_sym] = {:formatter => formatter, :helper => helper}
+        raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name.to_s]
+        @@formatters[name.to_s] = {:formatter => formatter, :helper => helper}
       end
       
       def formatter_for(name)
-        entry = @@formatters[name.to_sym]
+        entry = @@formatters[name.to_s]
         (entry && entry[:formatter]) || Redmine::WikiFormatting::NullFormatter::Formatter
       end
       
       def helper_for(name)
-        entry = @@formatters[name.to_sym]
+        entry = @@formatters[name.to_s]
         (entry && entry[:helper]) || Redmine::WikiFormatting::NullFormatter::Helper
       end
       
index f52c84e0e5123bd18d81e48e17b23a725327cd6a..deedebae13bb9b47c7c6fa5bef0576dd6eb206d7 100644 (file)
@@ -19,6 +19,16 @@ require File.dirname(__FILE__) + '/../../../test_helper'
 
 class Redmine::WikiFormattingTest < ActiveSupport::TestCase
   
+  def test_textile_formatter
+    assert_equal Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting.formatter_for('textile')
+    assert_equal Redmine::WikiFormatting::Textile::Helper, Redmine::WikiFormatting.helper_for('textile')
+  end
+  
+  def test_null_formatter
+    assert_equal Redmine::WikiFormatting::NullFormatter::Formatter, Redmine::WikiFormatting.formatter_for('')
+    assert_equal Redmine::WikiFormatting::NullFormatter::Helper, Redmine::WikiFormatting.helper_for('')
+  end
+  
   def test_should_link_urls_and_email_addresses
     raw = <<-DIFF
 This is a sample *text* with a link: http://www.redmine.org