]> source.dussan.org Git - redmine.git/commitdiff
Merged r11126 from trunk (#12744).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 9 Jan 2013 13:31:05 +0000 (13:31 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 9 Jan 2013 13:31:05 +0000 (13:31 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.2-stable@11145 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 64b7814b9c0b4bf91f83f95d030f1f8b71a30b61..5bafd269bca625c3aa752cd7682e425cf3b75743 100644 (file)
@@ -147,10 +147,10 @@ module Redmine
           unless block_given?
             raise "Can not create a macro without a block!"
           end
-          name = name.to_sym if name.is_a?(String)
+          name = name.to_s.downcase.to_sym
           available_macros[name] = {:desc => @@desc || ''}.merge(options)
           @@desc = nil
-          Definitions.send :define_method, "macro_#{name}".downcase, &block
+          Definitions.send :define_method, "macro_#{name}", &block
         end
 
         # Sets description for the next macro to be defined
index cd3ac7a48d6cd9b990c83b906813cf42b8c7b24b..d014aa5e6782bb84eaedeaac01e109dc74b431e8 100644 (file)
@@ -78,6 +78,12 @@ class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase
     assert_equal "<p>Baz: (arg1,arg2) (String) (line1\nline2)</p>", textilizable("{{baz(arg1, arg2)\nline1\nline2\n}}")
   end
 
+  def test_macro_name_with_upper_case
+    Redmine::WikiFormatting::Macros.macro(:UpperCase) {|obj, args| "Upper"}
+
+    assert_equal "<p>Upper</p>", textilizable("{{UpperCase}}")
+  end
+
   def test_multiple_macros_on_the_same_line
     Redmine::WikiFormatting::Macros.macro :foo do |obj, args|
       args.any? ? "args: #{args.join(',')}" : "no args"