Rubocop fixes for test/test_excerpt.rb
This commit is contained in:
parent
cfe6cf7ca1
commit
c8cae38da6
|
@ -73,7 +73,6 @@ AllCops:
|
|||
- test/test_configuration.rb
|
||||
- test/test_document.rb
|
||||
- test/test_entry_filter.rb
|
||||
- test/test_excerpt.rb
|
||||
- test/test_filters.rb
|
||||
- test/test_front_matter_defaults.rb
|
||||
- test/test_generated_site.rb
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
require 'helper'
|
||||
require "helper"
|
||||
|
||||
class TestExcerpt < JekyllUnitTest
|
||||
def setup_post(file)
|
||||
Document.new(@site.in_source_dir(File.join('_posts', file)), {
|
||||
site: @site,
|
||||
collection: @site.posts
|
||||
Document.new(@site.in_source_dir(File.join("_posts", file)), {
|
||||
:site => @site,
|
||||
:collection => @site.posts
|
||||
}).tap(&:read)
|
||||
end
|
||||
|
||||
def do_render(document)
|
||||
@site.layouts = { "default" => Layout.new(@site, source_dir('_layouts'), "simple.html")}
|
||||
@site.layouts = { "default" => Layout.new(@site, source_dir("_layouts"),
|
||||
"simple.html") }
|
||||
document.output = Jekyll::Renderer.new(@site, document, @site.site_payload).run
|
||||
end
|
||||
|
||||
context "With extraction disabled" do
|
||||
setup do
|
||||
clear_dest
|
||||
@site = fixture_site('excerpt_separator' => '')
|
||||
@site = fixture_site("excerpt_separator" => "")
|
||||
@post = setup_post("2013-07-22-post-excerpt-with-layout.markdown")
|
||||
end
|
||||
|
||||
|
@ -30,11 +31,10 @@ class TestExcerpt < JekyllUnitTest
|
|||
clear_dest
|
||||
@site = fixture_site
|
||||
@post = setup_post("2013-07-22-post-excerpt-with-layout.markdown")
|
||||
@excerpt = @post.data['excerpt']
|
||||
@excerpt = @post.data["excerpt"]
|
||||
end
|
||||
|
||||
context "#include(string)" do
|
||||
|
||||
setup do
|
||||
@excerpt.output = "Here is a fake output stub"
|
||||
end
|
||||
|
@ -78,19 +78,21 @@ class TestExcerpt < JekyllUnitTest
|
|||
context "#to_liquid" do
|
||||
should "contain the proper page data to mimick the post liquid" do
|
||||
assert_equal "Post Excerpt with Layout", @excerpt.to_liquid["title"]
|
||||
assert_equal "/bar/baz/z_category/mixedcase/2013/07/22/post-excerpt-with-layout.html", @excerpt.to_liquid["url"]
|
||||
assert_equal "/bar/baz/z_category/mixedcase/2013/07/22/"\
|
||||
"post-excerpt-with-layout.html", @excerpt.to_liquid["url"]
|
||||
assert_equal Time.parse("2013-07-22"), @excerpt.to_liquid["date"]
|
||||
assert_equal %w[bar baz z_category MixedCase], @excerpt.to_liquid["categories"]
|
||||
assert_equal %w[first second third jekyllrb.com], @excerpt.to_liquid["tags"]
|
||||
assert_equal "_posts/2013-07-22-post-excerpt-with-layout.markdown", @excerpt.to_liquid["path"]
|
||||
assert_equal %w(bar baz z_category MixedCase), @excerpt.to_liquid["categories"]
|
||||
assert_equal %w(first second third jekyllrb.com), @excerpt.to_liquid["tags"]
|
||||
assert_equal "_posts/2013-07-22-post-excerpt-with-layout.markdown",
|
||||
@excerpt.to_liquid["path"]
|
||||
end
|
||||
end
|
||||
|
||||
context "#content" do
|
||||
|
||||
context "before render" do
|
||||
should "be the first paragraph of the page" do
|
||||
assert_equal "First paragraph with [link ref][link].\n\n[link]: http://www.jekyllrb.com/", @excerpt.content
|
||||
assert_equal "First paragraph with [link ref][link].\n\n[link]:"\
|
||||
" http://www.jekyllrb.com/", @excerpt.content
|
||||
end
|
||||
|
||||
should "contain any refs at the bottom of the page" do
|
||||
|
@ -102,11 +104,12 @@ class TestExcerpt < JekyllUnitTest
|
|||
setup do
|
||||
@rendered_post = @post.dup
|
||||
do_render(@rendered_post)
|
||||
@extracted_excerpt = @rendered_post.data['excerpt']
|
||||
@extracted_excerpt = @rendered_post.data["excerpt"]
|
||||
end
|
||||
|
||||
should "be the first paragraph of the page" do
|
||||
assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">link ref</a>.</p>\n\n", @extracted_excerpt.output
|
||||
assert_equal "<p>First paragraph with <a href=\"http://www.jekyllrb.com/\">"\
|
||||
"link ref</a>.</p>\n\n", @extracted_excerpt.output
|
||||
end
|
||||
|
||||
should "link properly" do
|
||||
|
@ -121,7 +124,7 @@ class TestExcerpt < JekyllUnitTest
|
|||
clear_dest
|
||||
@site = fixture_site
|
||||
@post = setup_post("2008-02-02-published.markdown")
|
||||
@excerpt = @post.data['excerpt']
|
||||
@excerpt = @post.data["excerpt"]
|
||||
end
|
||||
|
||||
should "be generated" do
|
||||
|
|
Loading…
Reference in New Issue