Fix tests by adding a default_options hash to the wiki
This commit is contained in:
@@ -32,6 +32,10 @@ module Gollum
|
|||||||
# sanitization altogether.
|
# sanitization altogether.
|
||||||
attr_writer :history_sanitization
|
attr_writer :history_sanitization
|
||||||
|
|
||||||
|
# Hash for setting different default wiki options
|
||||||
|
# These defaults can be overridden by options passed directly to initialize()
|
||||||
|
attr_accessor :default_options
|
||||||
|
|
||||||
# Gets the page class used by all instances of this Wiki.
|
# Gets the page class used by all instances of this Wiki.
|
||||||
# Default: Gollum::Page.
|
# Default: Gollum::Page.
|
||||||
def page_class
|
def page_class
|
||||||
@@ -107,6 +111,7 @@ module Gollum
|
|||||||
self.default_committer_email = 'anon@anon.com'
|
self.default_committer_email = 'anon@anon.com'
|
||||||
|
|
||||||
self.default_ws_subs = ['_','-']
|
self.default_ws_subs = ['_','-']
|
||||||
|
self.default_options = {}
|
||||||
|
|
||||||
# The String base path to prefix to internal links. For example, when set
|
# The String base path to prefix to internal links. For example, when set
|
||||||
# to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
|
# to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
|
||||||
@@ -150,6 +155,7 @@ module Gollum
|
|||||||
#
|
#
|
||||||
# Returns a fresh Gollum::Repo.
|
# Returns a fresh Gollum::Repo.
|
||||||
def initialize(path, options = {})
|
def initialize(path, options = {})
|
||||||
|
options = self.class.default_options.merge(options)
|
||||||
if path.is_a?(GitAccess)
|
if path.is_a?(GitAccess)
|
||||||
options[:access] = path
|
options[:access] = path
|
||||||
path = path.path
|
path = path.path
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ context "Markup" do
|
|||||||
@path = testpath("examples/test.git")
|
@path = testpath("examples/test.git")
|
||||||
FileUtils.rm_rf(@path)
|
FileUtils.rm_rf(@path)
|
||||||
Grit::Repo.init_bare(@path)
|
Grit::Repo.init_bare(@path)
|
||||||
|
Gollum::Wiki.default_options = {:header_hashtags => false, :universal_toc => false}
|
||||||
@wiki = Gollum::Wiki.new(@path)
|
@wiki = Gollum::Wiki.new(@path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ end
|
|||||||
context "Wiki page previewing" do
|
context "Wiki page previewing" do
|
||||||
setup do
|
setup do
|
||||||
@path = testpath("examples/lotr.git")
|
@path = testpath("examples/lotr.git")
|
||||||
|
Gollum::Wiki.default_options = {:header_hashtags => false, :universal_toc => false}
|
||||||
@wiki = Gollum::Wiki.new(@path)
|
@wiki = Gollum::Wiki.new(@path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user