Merge pull request #371 from bootstraponline/searchfix
Search fix (#348 with assert_not_match replacement).
This commit is contained in:
@@ -91,7 +91,7 @@ module Gollum
|
|||||||
fullpath = ::File.join(*[@wiki.page_file_dir, dir, path].compact)
|
fullpath = ::File.join(*[@wiki.page_file_dir, dir, path].compact)
|
||||||
fullpath = fullpath[1..-1] if fullpath =~ /^\//
|
fullpath = fullpath[1..-1] if fullpath =~ /^\//
|
||||||
|
|
||||||
if index.current_tree && tree = index.current_tree / dir
|
if index.current_tree && tree = index.current_tree / (@wiki.page_file_dir || '/') / dir
|
||||||
downpath = path.downcase.sub(/\.\w+$/, '')
|
downpath = path.downcase.sub(/\.\w+$/, '')
|
||||||
|
|
||||||
tree.blobs.each do |blob|
|
tree.blobs.each do |blob|
|
||||||
|
|||||||
@@ -192,3 +192,35 @@ context "Frontend" do
|
|||||||
Precious::App
|
Precious::App
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "Frontend with page-file-dir" do
|
||||||
|
include Rack::Test::Methods
|
||||||
|
|
||||||
|
setup do
|
||||||
|
@path = cloned_testpath("examples/page_file_dir.git")
|
||||||
|
@wiki = Gollum::Wiki.new(@path, { :page_file_dir => "docs" })
|
||||||
|
Precious::App.set(:gollum_path, @path)
|
||||||
|
Precious::App.set(:wiki_options, { :page_file_dir => "docs" })
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
FileUtils.rm_rf(@path)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "open existing parent" do
|
||||||
|
get "/"
|
||||||
|
assert last_response.ok?
|
||||||
|
|
||||||
|
post "/create", :content => "asdf", :page => "bar",
|
||||||
|
:format => 'markdown'
|
||||||
|
follow_redirect!
|
||||||
|
assert last_response.ok?
|
||||||
|
|
||||||
|
# Assert not match.
|
||||||
|
assert_equal true, /Duplicate page/.match(last_response.body) == nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def app
|
||||||
|
Precious::App
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user