749b5a5ff8
hack for 1.8.7 Don't miss test_markup's relative require need some food now
53 lines
1.4 KiB
Ruby
53 lines
1.4 KiB
Ruby
# ~*~ encoding: utf-8 ~*~
|
|
require File.expand_path( '../helper', __FILE__ )
|
|
require File.expand_path( '../wiki_factory', __FILE__ )
|
|
|
|
context "gitcode" do
|
|
|
|
def page_with_content c
|
|
index = @wiki.repo.index
|
|
index.add 'Sample-Html.md', c
|
|
index.commit 'adding file html sample'
|
|
|
|
page = @wiki.page 'Sample Html'
|
|
page
|
|
end
|
|
|
|
setup do
|
|
# context
|
|
@wiki, @path, @cleanup = WikiFactory.create 'examples/test.git'
|
|
|
|
# given
|
|
p = page_with_content "a\n\n```html:github/gollum/master/test/file_view/1_file.txt```\n\nb"
|
|
|
|
# when rendering the page
|
|
@rendered = Gollum::Markup.new(p).render
|
|
end
|
|
|
|
test 'that the rendered output is correctly fetched and rendered as html code' do
|
|
assert_equal %Q{<p>a</p>
|
|
|
|
<div class="highlight">
|
|
<pre><span class="nt"><ol</span> <span class="na">class=</span><span class="s">"tree"</span><span class="nt">></span>
|
|
<span class="nt"><li</span> <span class="na">class=</span><span class="s">"file"</span><span class="nt">><a</span> <span class="na">href=</span><span class="s">"0"</span><span class="nt">></span>0<span class="nt"></a></li></span>
|
|
<span class="nt"></ol></span>
|
|
</pre>
|
|
</div>
|
|
|
|
|
|
<p>b</p>}, @rendered
|
|
end
|
|
|
|
test 'contents' do
|
|
g = Gollum::Gitcode.new 'github/gollum/master/test/file_view/1_file.txt'
|
|
|
|
assert_equal g.contents, %{<ol class="tree">
|
|
<li class="file"><a href="0">0</a></li>
|
|
</ol>}
|
|
end
|
|
|
|
teardown do
|
|
@cleanup.()
|
|
end
|
|
end
|