diff --git a/.rubocop.yml b/.rubocop.yml index 4a1b4fea..bb0f2381 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -74,7 +74,6 @@ AllCops: - test/test_document.rb - test/test_entry_filter.rb - test/test_filters.rb - - test/test_generated_site.rb - test/test_kramdown.rb - test/test_layout_reader.rb - test/test_liquid_extensions.rb diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index 301cd8f8..46374862 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -1,14 +1,15 @@ -require 'helper' +require "helper" class TestGeneratedSite < JekyllUnitTest context "generated sites" do setup do 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.process - @index = File.read(dest_dir('index.html')) + @index = File.read(dest_dir("index.html")) end should "ensure post count is as expected" do @@ -24,29 +25,29 @@ class TestGeneratedSite < JekyllUnitTest end 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 "published.html", published.first end should "hide unpublished page" do - refute_exist dest_dir('/unpublished.html') + refute_exist dest_dir("/unpublished.html") end should "not copy _posts directory" do - refute_exist dest_dir('_posts') + refute_exist dest_dir("_posts") end should "process a page with a folder permalink properly" do - about = @site.pages.find {|page| page.name == 'about.html' } - assert_equal dest_dir('about', 'index.html'), about.destination(dest_dir) - assert_exist dest_dir('about', 'index.html') + about = @site.pages.find { |page| page.name == "about.html" } + assert_equal dest_dir("about", "index.html"), about.destination(dest_dir) + assert_exist dest_dir("about", "index.html") end should "process other static files and generate correct permalinks" do - assert_exist dest_dir('contacts.html') - assert_exist dest_dir('dynamic_file.php') + assert_exist dest_dir("contacts.html") + assert_exist dest_dir("dynamic_file.php") end 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 - /symlink-test/symlinked-dir/screen.css last edited at #{time_regexp} with extname .css 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 context "generating limited posts" do setup do 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.process - @index = File.read(dest_dir('index.html')) + @index = File.read(dest_dir("index.html")) end should "generate only the specified number of posts" do @@ -78,9 +81,9 @@ OUTPUT assert_raises ArgumentError do clear_dest config = Jekyll::Configuration::DEFAULTS.merge({ - 'source' => source_dir, - 'destination' => dest_dir, - 'limit_posts' => -1 + "source" => source_dir, + "destination" => dest_dir, + "limit_posts" => -1 }) @site = fixture_site(config) end @@ -89,9 +92,9 @@ OUTPUT should "acceptable limit post is 0" do clear_dest config = Jekyll::Configuration::DEFAULTS.merge({ - 'source' => source_dir, - 'destination' => dest_dir, - 'limit_posts' => 0 + "source" => source_dir, + "destination" => dest_dir, + "limit_posts" => 0 }) assert Site.new(config), "Couldn't create a site with the given limit_posts."