Sha256: 00905153f23bfc62f2e403e086ef0511c97237dce7a0a12a8d09305e6af8e997
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
# ~*~ encoding: utf-8 ~*~ require File.expand_path(File.join(File.dirname(__FILE__), 'helper')) require File.expand_path '../../lib/gollum/frontend/views/pages', __FILE__ FakeResult = Struct.new(:path) do def name File.basename(path, File.extname(path)).gsub("-", " ") end def escaped_url_path CGI.escape(path).gsub(/\..+$/, "").gsub("%2F", "/") end end context "Precious::Views::Pages" do setup do @page = Precious::Views::Pages.new end test "breadcrumb" do @page.instance_variable_set("@path", "Mordor/Eye-Of-Sauron/Saruman") @page.instance_variable_set("@base_url", "/") assert_equal '<a href="/pages/">Home</a> / <a href="/pages/Mordor/">Mordor</a> / <a href="/pages/Mordor/Eye-Of-Sauron/">Eye-Of-Sauron</a> / Saruman', @page.breadcrumb end test "breadcrumb with no path" do assert_equal 'Home', @page.breadcrumb end test "files_folders" do @page.instance_variable_set("@path", "Mordor") @page.instance_variable_set("@base_url", "/") 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="/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 end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gollum-2.1.3 | test/test_pages_view.rb |
gollum-2.1.2 | test/test_pages_view.rb |
gollum-2.1.0 | test/test_pages_view.rb |