0364d6e1be
`Test::Unit` is deprecated, and we can switch to `Minitest::Test` with almost no side effects. This commit does all of the work required to make Minitest tests run with Gollum's existing test helpers.
48 lines
1.1 KiB
Ruby
48 lines
1.1 KiB
Ruby
# ~*~ encoding: utf-8 ~*~
|
|
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
|
|
|
class TestTemplateCascade < Minitest::Unit::TestCase
|
|
include Rack::Test::Methods
|
|
|
|
def setup
|
|
@path = cloned_testpath('examples/lotr.git')
|
|
Precious::App.set(:gollum_path, @path)
|
|
Precious::App.set(:wiki_options, {template_dir: testpath('examples/template_cascade')})
|
|
@wiki = Gollum::Wiki.new(@path)
|
|
end
|
|
|
|
def teardown
|
|
FileUtils.rm_rf(@path)
|
|
end
|
|
|
|
def app
|
|
Precious::App
|
|
end
|
|
|
|
def test_overridden_page_template_is_used
|
|
get '/Home'
|
|
|
|
assert last_response.body.include?('PAGE_OVERRIDE')
|
|
end
|
|
|
|
def test_overridden_navbar_partial_is_used
|
|
get '/Home'
|
|
|
|
assert last_response.body.include?('NAVBAR_OVERRIDE')
|
|
end
|
|
|
|
def test_overridden_templates_are_ignore_without_template_dir_set
|
|
Precious::App.set(:wiki_options, {template_dir: nil})
|
|
|
|
get '/Home'
|
|
assert_equal '/Home', last_request.fullpath
|
|
assert last_response.ok?
|
|
refute_match /PAGE_OVERRIDE/, last_response.body
|
|
refute_match /NAVBAR_OVERRIDE/, last_response.body
|
|
end
|
|
|
|
def teardown
|
|
FileUtils.rm_rf(@path)
|
|
end
|
|
end
|