Rubocop fixes for test/test_generated_site.rb
This commit is contained in:
parent
555b2fbe72
commit
0635bbba06
|
@ -74,7 +74,6 @@ AllCops:
|
||||||
- test/test_document.rb
|
- test/test_document.rb
|
||||||
- test/test_entry_filter.rb
|
- test/test_entry_filter.rb
|
||||||
- test/test_filters.rb
|
- test/test_filters.rb
|
||||||
- test/test_generated_site.rb
|
|
||||||
- test/test_kramdown.rb
|
- test/test_kramdown.rb
|
||||||
- test/test_layout_reader.rb
|
- test/test_layout_reader.rb
|
||||||
- test/test_liquid_extensions.rb
|
- test/test_liquid_extensions.rb
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
require 'helper'
|
require "helper"
|
||||||
|
|
||||||
class TestGeneratedSite < JekyllUnitTest
|
class TestGeneratedSite < JekyllUnitTest
|
||||||
context "generated sites" do
|
context "generated sites" do
|
||||||
setup do
|
setup do
|
||||||
clear_dest
|
clear_dest
|
||||||
config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
|
config = Jekyll::Configuration::DEFAULTS.merge({ "source" => source_dir,
|
||||||
|
"destination" => dest_dir })
|
||||||
|
|
||||||
@site = fixture_site(config)
|
@site = fixture_site(config)
|
||||||
@site.process
|
@site.process
|
||||||
@index = File.read(dest_dir('index.html'))
|
@index = File.read(dest_dir("index.html"))
|
||||||
end
|
end
|
||||||
|
|
||||||
should "ensure post count is as expected" do
|
should "ensure post count is as expected" do
|
||||||
|
@ -24,29 +25,29 @@ class TestGeneratedSite < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
should "hide unpublished posts" do
|
should "hide unpublished posts" do
|
||||||
published = Dir[dest_dir('publish_test/2008/02/02/*.html')].map {|f| File.basename(f)}
|
published = Dir[dest_dir("publish_test/2008/02/02/*.html")].map \
|
||||||
|
{ |f| File.basename(f) }
|
||||||
assert_equal 1, published.size
|
assert_equal 1, published.size
|
||||||
assert_equal "published.html", published.first
|
assert_equal "published.html", published.first
|
||||||
end
|
end
|
||||||
|
|
||||||
should "hide unpublished page" do
|
should "hide unpublished page" do
|
||||||
refute_exist dest_dir('/unpublished.html')
|
refute_exist dest_dir("/unpublished.html")
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not copy _posts directory" do
|
should "not copy _posts directory" do
|
||||||
refute_exist dest_dir('_posts')
|
refute_exist dest_dir("_posts")
|
||||||
end
|
end
|
||||||
|
|
||||||
should "process a page with a folder permalink properly" do
|
should "process a page with a folder permalink properly" do
|
||||||
about = @site.pages.find {|page| page.name == 'about.html' }
|
about = @site.pages.find { |page| page.name == "about.html" }
|
||||||
assert_equal dest_dir('about', 'index.html'), about.destination(dest_dir)
|
assert_equal dest_dir("about", "index.html"), about.destination(dest_dir)
|
||||||
assert_exist dest_dir('about', 'index.html')
|
assert_exist dest_dir("about", "index.html")
|
||||||
end
|
end
|
||||||
|
|
||||||
should "process other static files and generate correct permalinks" do
|
should "process other static files and generate correct permalinks" do
|
||||||
assert_exist dest_dir('contacts.html')
|
assert_exist dest_dir("contacts.html")
|
||||||
assert_exist dest_dir('dynamic_file.php')
|
assert_exist dest_dir("dynamic_file.php")
|
||||||
end
|
end
|
||||||
|
|
||||||
should "print a nice list of static files" do
|
should "print a nice list of static files" do
|
||||||
|
@ -57,17 +58,19 @@ class TestGeneratedSite < JekyllUnitTest
|
||||||
- /products.yml last edited at #{time_regexp} with extname .yml
|
- /products.yml last edited at #{time_regexp} with extname .yml
|
||||||
- /symlink-test/symlinked-dir/screen.css last edited at #{time_regexp} with extname .css
|
- /symlink-test/symlinked-dir/screen.css last edited at #{time_regexp} with extname .css
|
||||||
OUTPUT
|
OUTPUT
|
||||||
assert_match expected_output, File.read(dest_dir('static_files.html'))
|
assert_match expected_output, File.read(dest_dir("static_files.html"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "generating limited posts" do
|
context "generating limited posts" do
|
||||||
setup do
|
setup do
|
||||||
clear_dest
|
clear_dest
|
||||||
config = Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 5})
|
config = Jekyll::Configuration::DEFAULTS.merge({ "source" => source_dir,
|
||||||
|
"destination" => dest_dir,
|
||||||
|
"limit_posts" => 5 })
|
||||||
@site = fixture_site(config)
|
@site = fixture_site(config)
|
||||||
@site.process
|
@site.process
|
||||||
@index = File.read(dest_dir('index.html'))
|
@index = File.read(dest_dir("index.html"))
|
||||||
end
|
end
|
||||||
|
|
||||||
should "generate only the specified number of posts" do
|
should "generate only the specified number of posts" do
|
||||||
|
@ -78,9 +81,9 @@ OUTPUT
|
||||||
assert_raises ArgumentError do
|
assert_raises ArgumentError do
|
||||||
clear_dest
|
clear_dest
|
||||||
config = Jekyll::Configuration::DEFAULTS.merge({
|
config = Jekyll::Configuration::DEFAULTS.merge({
|
||||||
'source' => source_dir,
|
"source" => source_dir,
|
||||||
'destination' => dest_dir,
|
"destination" => dest_dir,
|
||||||
'limit_posts' => -1
|
"limit_posts" => -1
|
||||||
})
|
})
|
||||||
@site = fixture_site(config)
|
@site = fixture_site(config)
|
||||||
end
|
end
|
||||||
|
@ -89,9 +92,9 @@ OUTPUT
|
||||||
should "acceptable limit post is 0" do
|
should "acceptable limit post is 0" do
|
||||||
clear_dest
|
clear_dest
|
||||||
config = Jekyll::Configuration::DEFAULTS.merge({
|
config = Jekyll::Configuration::DEFAULTS.merge({
|
||||||
'source' => source_dir,
|
"source" => source_dir,
|
||||||
'destination' => dest_dir,
|
"destination" => dest_dir,
|
||||||
'limit_posts' => 0
|
"limit_posts" => 0
|
||||||
})
|
})
|
||||||
|
|
||||||
assert Site.new(config), "Couldn't create a site with the given limit_posts."
|
assert Site.new(config), "Couldn't create a site with the given limit_posts."
|
||||||
|
|
Loading…
Reference in New Issue