add backwards compatible Gollum::Wiki.markup_class

This commit is contained in:
risk
2011-07-21 16:17:09 -07:00
parent aadbdd8b76
commit c9c7db5a53
2 changed files with 24 additions and 0 deletions
+10
View File
@@ -66,6 +66,16 @@ module Gollum
end
end
def markup_class
markup_classes[:default]
end
def markup_class=(default)
new_classes = Hash.new default
@markup_classes = Hash.new(default).update(markup_classes)
default
end
# Gets the default sanitization options for current pages used by
# instances of this Wiki.
def sanitization
+14
View File
@@ -4,6 +4,20 @@ require File.expand_path(File.join(File.dirname(__FILE__), "helper"))
context "Wiki" do
setup do
@wiki = Gollum::Wiki.new(testpath("examples/lotr.git"))
Gollum::Wiki.markup_classes = nil
end
test "#markup_class gets default markup" do
assert_equal Gollum::Markup, Gollum::Wiki.markup_class
end
test "#markup_class= doesn't clobber alternate markups" do
custom = Class.new(Gollum::Markup)
Gollum::Wiki.markup_class = custom
assert_equal custom, Gollum::Wiki.markup_class
assert_equal custom, Gollum::Wiki.markup_classes[:orgmode]
assert_equal Gollum::MarkupGFM, Gollum::Wiki.markup_classes[:markdown]
end
test "repo path" do