Improve #470 fix.

This commit is contained in:
bootstraponline
2012-08-15 12:03:48 -06:00
parent 523f8f80ca
commit 2d13bd796f
2 changed files with 10 additions and 2 deletions
+1 -2
View File
@@ -6,8 +6,7 @@ module Precious
attr_reader :results, :ref
def prefix
return '/' if @base_url.nil?
@base_url.chomp('/').empty? ? '/' : @base_url + '/'
@base_url ? @base_url.chomp('/') + '/' : '/'
end
def title
+9
View File
@@ -34,4 +34,13 @@ context "Precious::Views::Pages" do
@page.instance_variable_set("@results", results)
assert_equal %{<li><a href="/Mordor/Eye-Of-Sauron" class="file">Eye Of Sauron</a></li>\n<li><a href="/pages/Mordor/Orc/" class="folder">Orc</a></li>}, @page.files_folders
end
test "base url" do
# based on test "files_folders"
@page.instance_variable_set("@path", "Mordor")
@page.instance_variable_set("@base_url", "/wiki")
results = [FakeResult.new("Mordor/Eye-Of-Sauron.md"), FakeResult.new("Mordor/Orc/Saruman.md"), FakeResult.new("Mordor/.gitkeep")]
@page.instance_variable_set("@results", results)
assert_equal %{<li><a href="/wiki/Mordor/Eye-Of-Sauron" class="file">Eye Of Sauron</a></li>\n<li><a href="/wiki/pages/Mordor/Orc/" class="folder">Orc</a></li>}, @page.files_folders
end
end