(«|«)Pit(›|›)hy(»|»)<\/p>!, \
- markdown.convert(%("Pit'hy")).strip
+ markdown.convert(%("Pit'hy")).strip
end
end
@@ -142,16 +142,17 @@ class TestKramdown < JekyllUnitTest
should "move coderay to syntax_highlighter_opts" do
original = Kramdown::Document.method(:new)
- markdown = Converters::Markdown.new(Utils.deep_merge_hashes(@config, {
- "higlighter" => nil,
- "markdown" => "kramdown",
- "kramdown" => {
- "syntax_highlighter" => "coderay",
- "coderay" => {
- "hello" => "world",
- },
- },
- }))
+ markdown = Converters::Markdown.new(
+ Utils.deep_merge_hashes(@config,
+ "higlighter" => nil,
+ "markdown" => "kramdown",
+ "kramdown" => {
+ "syntax_highlighter" => "coderay",
+ "coderay" => {
+ "hello" => "world",
+ },
+ })
+ )
expect(Kramdown::Document).to receive(:new) do |arg1, hash|
assert_equal hash["syntax_highlighter_opts"]["hello"], "world"
diff --git a/test/test_layout_reader.rb b/test/test_layout_reader.rb
index 96d2045a..3c88586a 100644
--- a/test/test_layout_reader.rb
+++ b/test/test_layout_reader.rb
@@ -5,8 +5,8 @@ require "helper"
class TestLayoutReader < JekyllUnitTest
context "reading layouts" do
setup do
- 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)
end
diff --git a/test/test_liquid_extensions.rb b/test/test_liquid_extensions.rb
index e281e10e..30637b33 100644
--- a/test/test_liquid_extensions.rb
+++ b/test/test_liquid_extensions.rb
@@ -22,11 +22,11 @@ class TestLiquidExtensions < JekyllUnitTest
end
should "extract the var properly" do
- assert_equal @template.render({ "page" => { "name" => "tobi" } }), "hi tobi"
+ assert_equal @template.render("page" => { "name" => "tobi" }), "hi tobi"
end
should "return the variable name if the value isn't there" do
- assert_equal @template.render({ "page" => { "title" => "tobi" } }), "hi page.name"
+ assert_equal @template.render("page" => { "title" => "tobi" }), "hi page.name"
end
end
end
diff --git a/test/test_page.rb b/test/test_page.rb
index ed4c2c31..a34a5694 100644
--- a/test/test_page.rb
+++ b/test/test_page.rb
@@ -22,11 +22,11 @@ class TestPage < JekyllUnitTest
context "A Page" do
setup do
clear_dest
- @site = Site.new(Jekyll.configuration({
- "source" => source_dir,
- "destination" => dest_dir,
- "skip_config_files" => true,
- }))
+ @site = Site.new(Jekyll.configuration(
+ "source" => source_dir,
+ "destination" => dest_dir,
+ "skip_config_files" => true
+ ))
end
context "processing pages" do
diff --git a/test/test_page_without_a_file.rb b/test/test_page_without_a_file.rb
index 50624890..2933bfc8 100644
--- a/test/test_page_without_a_file.rb
+++ b/test/test_page_without_a_file.rb
@@ -21,11 +21,11 @@ class TestPageWithoutAFile < JekyllUnitTest
context "A PageWithoutAFile" do
setup do
clear_dest
- @site = Site.new(Jekyll.configuration({
- "source" => source_dir,
- "destination" => dest_dir,
- "skip_config_files" => true,
- }))
+ @site = Site.new(Jekyll.configuration(
+ "source" => source_dir,
+ "destination" => dest_dir,
+ "skip_config_files" => true
+ ))
end
context "with default site configuration" do
diff --git a/test/test_plugin_manager.rb b/test/test_plugin_manager.rb
index 213bcef6..b5d1a81c 100644
--- a/test/test_plugin_manager.rb
+++ b/test/test_plugin_manager.rb
@@ -24,7 +24,7 @@ class TestPluginManager < JekyllUnitTest
should "not require from bundler" do
with_env("JEKYLL_NO_BUNDLER_REQUIRE", "true") do
refute Jekyll::PluginManager.require_from_bundler,
- "Gemfile plugins were required but shouldn't have been"
+ "Gemfile plugins were required but shouldn't have been"
assert ENV["JEKYLL_NO_BUNDLER_REQUIRE"]
end
end
@@ -35,7 +35,7 @@ class TestPluginManager < JekyllUnitTest
with_env("JEKYLL_NO_BUNDLER_REQUIRE", nil) do
with_no_gemfile do
refute Jekyll::PluginManager.require_from_bundler,
- "Gemfile plugins were required but shouldn't have been"
+ "Gemfile plugins were required but shouldn't have been"
assert_nil ENV["JEKYLL_NO_BUNDLER_REQUIRE"]
end
end
@@ -68,9 +68,9 @@ class TestPluginManager < JekyllUnitTest
end
should "require plugin files" do
- site = double({ :safe => false,
- :config => { "plugins_dir" => "_plugins" },
- :in_source_dir => "/tmp/", })
+ site = double(:safe => false,
+ :config => { "plugins_dir" => "_plugins" },
+ :in_source_dir => "/tmp/")
plugin_manager = PluginManager.new(site)
expect(Jekyll::External).to receive(:require_with_graceful_fail)
@@ -80,7 +80,7 @@ class TestPluginManager < JekyllUnitTest
context "site is marked as safe" do
should "allow plugins if they are whitelisted" do
- site = double({ :safe => true, :config => { "whitelist" => ["jemoji"] } })
+ site = double(:safe => true, :config => { "whitelist" => ["jemoji"] })
plugin_manager = PluginManager.new(site)
assert plugin_manager.plugin_allowed?("jemoji")
@@ -88,7 +88,7 @@ class TestPluginManager < JekyllUnitTest
end
should "not require plugin files" do
- site = double({ :safe => true })
+ site = double(:safe => true)
plugin_manager = PluginManager.new(site)
expect(Jekyll::External).to_not receive(:require_with_graceful_fail)
@@ -98,12 +98,12 @@ class TestPluginManager < JekyllUnitTest
context "plugins_dir is set to the default" do
should "call site's in_source_dir" do
- site = double({
+ site = double(
:config => {
"plugins_dir" => Jekyll::Configuration::DEFAULTS["plugins_dir"],
},
- :in_source_dir => "/tmp/",
- })
+ :in_source_dir => "/tmp/"
+ )
plugin_manager = PluginManager.new(site)
expect(site).to receive(:in_source_dir).with("_plugins")
@@ -113,7 +113,7 @@ class TestPluginManager < JekyllUnitTest
context "plugins_dir is set to a different dir" do
should "expand plugin path" do
- site = double({ :config => { "plugins_dir" => "some_other_plugins_path" } })
+ site = double(:config => { "plugins_dir" => "some_other_plugins_path" })
plugin_manager = PluginManager.new(site)
expect(File).to receive(:expand_path).with("some_other_plugins_path")
@@ -123,7 +123,7 @@ class TestPluginManager < JekyllUnitTest
context "`paginate` config is activated" do
should "print deprecation warning if jekyll-paginate is not present" do
- site = double({ :config => { "paginate" => true } })
+ site = double(:config => { "paginate" => true })
plugin_manager = PluginManager.new(site)
expect(Jekyll::Deprecator).to(
@@ -133,9 +133,9 @@ class TestPluginManager < JekyllUnitTest
end
should "print no deprecation warning if jekyll-paginate is present" do
- site = double({
- :config => { "paginate" => true, "plugins" => ["jekyll-paginate"] },
- })
+ site = double(
+ :config => { "paginate" => true, "plugins" => ["jekyll-paginate"] }
+ )
plugin_manager = PluginManager.new(site)
expect(Jekyll::Deprecator).to_not receive(:deprecation_message)
@@ -144,10 +144,10 @@ class TestPluginManager < JekyllUnitTest
end
should "conscientious require" do
- site = double({
+ site = double(
:config => { "theme" => "test-dependency-theme" },
- :in_dest_dir => "/tmp/_site/",
- })
+ :in_dest_dir => "/tmp/_site/"
+ )
plugin_manager = PluginManager.new(site)
expect(site).to receive(:theme).and_return(true)
diff --git a/test/test_regenerator.rb b/test/test_regenerator.rb
index 3a5d35a8..122bc40f 100644
--- a/test/test_regenerator.rb
+++ b/test/test_regenerator.rb
@@ -7,14 +7,14 @@ class TestRegenerator < JekyllUnitTest
setup do
FileUtils.rm_rf(source_dir(".jekyll-metadata"))
- @site = fixture_site({
+ @site = fixture_site(
"collections" => {
"methods" => {
"output" => true,
},
},
- "incremental" => true,
- })
+ "incremental" => true
+ )
@site.read
@page = @site.pages.first
@@ -93,9 +93,9 @@ class TestRegenerator < JekyllUnitTest
context "The site regenerator" do
setup do
FileUtils.rm_rf(source_dir(".jekyll-metadata"))
- @site = fixture_site({
- "incremental" => true,
- })
+ @site = fixture_site(
+ "incremental" => true
+ )
@site.read
@post = @site.posts.first
@@ -128,11 +128,11 @@ class TestRegenerator < JekyllUnitTest
setup do
FileUtils.rm_rf(source_dir(".jekyll-metadata"))
- @site = Site.new(Jekyll.configuration({
- "source" => source_dir,
- "destination" => dest_dir,
- "incremental" => true,
- }))
+ @site = Site.new(Jekyll.configuration(
+ "source" => source_dir,
+ "destination" => dest_dir,
+ "incremental" => true
+ ))
@site.process
@path = @site.in_source_dir(@site.pages.first.path)
@@ -183,7 +183,7 @@ class TestRegenerator < JekyllUnitTest
should "not crash when reading corrupted marshal file" do
metadata_file = source_dir(".jekyll-metadata")
File.open(metadata_file, "w") do |file|
- file.puts Marshal.dump({ :foo => "bar" })[0, 5]
+ file.puts Marshal.dump(:foo => "bar")[0, 5]
end
@regenerator = Regenerator.new(@site)
@@ -310,11 +310,11 @@ class TestRegenerator < JekyllUnitTest
context "when incremental regeneration is disabled" do
setup do
FileUtils.rm_rf(source_dir(".jekyll-metadata"))
- @site = Site.new(Jekyll.configuration({
- "source" => source_dir,
- "destination" => dest_dir,
- "incremental" => false,
- }))
+ @site = Site.new(Jekyll.configuration(
+ "source" => source_dir,
+ "destination" => dest_dir,
+ "incremental" => false
+ ))
@site.process
@path = @site.in_source_dir(@site.pages.first.path)
diff --git a/test/test_related_posts.rb b/test/test_related_posts.rb
index d6a8fe6f..7f9a978f 100644
--- a/test/test_related_posts.rb
+++ b/test/test_related_posts.rb
@@ -29,9 +29,9 @@ class TestRelatedPosts < JekyllUnitTest
end
allow_any_instance_of(Jekyll::RelatedPosts).to receive(:display)
- @site = fixture_site({
- "lsi" => true,
- })
+ @site = fixture_site(
+ "lsi" => true
+ )
@site.reset
@site.read
diff --git a/test/test_sass.rb b/test/test_sass.rb
index 15b04162..686631d6 100644
--- a/test/test_sass.rb
+++ b/test/test_sass.rb
@@ -5,10 +5,10 @@ require "helper"
class TestSass < JekyllUnitTest
context "importing partials" do
setup do
- @site = Jekyll::Site.new(Jekyll.configuration({
- "source" => source_dir,
- "destination" => dest_dir,
- }))
+ @site = Jekyll::Site.new(Jekyll.configuration(
+ "source" => source_dir,
+ "destination" => dest_dir
+ ))
@site.process
@test_css_file = dest_dir("css/main.css")
end
diff --git a/test/test_site.rb b/test/test_site.rb
index 0af32fcb..63fb63fd 100644
--- a/test/test_site.rb
+++ b/test/test_site.rb
@@ -15,7 +15,7 @@ class TestSite < JekyllUnitTest
@site.posts.docs.concat(PostReader.new(@site).read_posts(""))
posts = Dir[source_dir("_posts", "**", "*")]
posts.delete_if do |post|
- File.directory?(post) && !(post =~ Document::DATE_FILENAME_MATCHER)
+ File.directory?(post) && post !~ Document::DATE_FILENAME_MATCHER
end
end
@@ -31,15 +31,15 @@ class TestSite < JekyllUnitTest
end
should "have an array for plugins if passed as a string" do
- site = Site.new(site_configuration({ "plugins_dir" => "/tmp/plugins" }))
+ site = Site.new(site_configuration("plugins_dir" => "/tmp/plugins"))
array = Utils::Platforms.windows? ? ["C:/tmp/plugins"] : ["/tmp/plugins"]
assert_equal array, site.plugins
end
should "have an array for plugins if passed as an array" do
- site = Site.new(site_configuration({
- "plugins_dir" => ["/tmp/plugins", "/tmp/otherplugins"],
- }))
+ site = Site.new(site_configuration(
+ "plugins_dir" => ["/tmp/plugins", "/tmp/otherplugins"]
+ ))
array = if Utils::Platforms.windows?
["C:/tmp/plugins", "C:/tmp/otherplugins"]
else
@@ -49,12 +49,12 @@ class TestSite < JekyllUnitTest
end
should "have an empty array for plugins if nothing is passed" do
- site = Site.new(site_configuration({ "plugins_dir" => [] }))
+ site = Site.new(site_configuration("plugins_dir" => []))
assert_equal [], site.plugins
end
should "have the default for plugins if nil is passed" do
- site = Site.new(site_configuration({ "plugins_dir" => nil }))
+ site = Site.new(site_configuration("plugins_dir" => nil))
assert_equal [source_dir("_plugins")], site.plugins
end
@@ -64,19 +64,19 @@ class TestSite < JekyllUnitTest
end
should "expose baseurl passed in from config" do
- site = Site.new(site_configuration({ "baseurl" => "/blog" }))
+ site = Site.new(site_configuration("baseurl" => "/blog"))
assert_equal "/blog", site.baseurl
end
should "only include theme includes_path if the path exists" do
- site = fixture_site({ "theme" => "test-theme" })
+ site = fixture_site("theme" => "test-theme")
assert_equal [source_dir("_includes"), theme_dir("_includes")],
- site.includes_load_paths
+ site.includes_load_paths
allow(File).to receive(:directory?).with(theme_dir("_sass")).and_return(true)
allow(File).to receive(:directory?).with(theme_dir("_layouts")).and_return(true)
allow(File).to receive(:directory?).with(theme_dir("_includes")).and_return(false)
- site = fixture_site({ "theme" => "test-theme" })
+ site = fixture_site("theme" => "test-theme")
assert_equal [source_dir("_includes")], site.includes_load_paths
end
end
@@ -87,9 +87,7 @@ class TestSite < JekyllUnitTest
end
teardown do
- if defined?(MyGenerator)
- self.class.send(:remove_const, :MyGenerator)
- end
+ self.class.send(:remove_const, :MyGenerator) if defined?(MyGenerator)
end
should "have an empty tag hash by default" do
@@ -279,7 +277,7 @@ class TestSite < JekyllUnitTest
posts = Dir[source_dir("**", "_posts", "**", "*")]
posts.delete_if do |post|
- File.directory?(post) && !(post =~ Document::DATE_FILENAME_MATCHER)
+ File.directory?(post) && post !~ Document::DATE_FILENAME_MATCHER
end
categories = %w(
2013 bar baz category foo z_category MixedCase Mixedcase publish_test win
@@ -305,9 +303,9 @@ class TestSite < JekyllUnitTest
should "raise for bad frontmatter if strict_front_matter is set" do
site = Site.new(site_configuration(
- "collections" => ["broken"],
- "strict_front_matter" => true
- ))
+ "collections" => ["broken"],
+ "strict_front_matter" => true
+ ))
assert_raises(Psych::SyntaxError) do
site.process
end
@@ -315,9 +313,9 @@ class TestSite < JekyllUnitTest
should "not raise for bad frontmatter if strict_front_matter is not set" do
site = Site.new(site_configuration(
- "collections" => ["broken"],
- "strict_front_matter" => false
- ))
+ "collections" => ["broken"],
+ "strict_front_matter" => false
+ ))
site.process
end
end
@@ -412,9 +410,9 @@ class TestSite < JekyllUnitTest
bad_processor = "Custom::Markdown"
s = Site.new(site_configuration(
- "markdown" => bad_processor,
- "incremental" => false
- ))
+ "markdown" => bad_processor,
+ "incremental" => false
+ ))
assert_raises Jekyll::Errors::FatalException do
s.process
end
@@ -433,9 +431,9 @@ class TestSite < JekyllUnitTest
should "throw FatalException at process time" do
bad_processor = "not a processor name"
s = Site.new(site_configuration(
- "markdown" => bad_processor,
- "incremental" => false
- ))
+ "markdown" => bad_processor,
+ "incremental" => false
+ ))
assert_raises Jekyll::Errors::FatalException do
s.process
end
@@ -489,8 +487,8 @@ class TestSite < JekyllUnitTest
site.process
file_content = SafeYAML.load_file(File.join(
- source_dir, "_data", "categories", "dairy.yaml"
- ))
+ source_dir, "_data", "categories", "dairy.yaml"
+ ))
assert_equal site.data["categories"]["dairy"], file_content
assert_equal(
@@ -504,8 +502,8 @@ class TestSite < JekyllUnitTest
site.process
file_content = SafeYAML.load_file(File.join(
- source_dir, "_data", "categories.01", "dairy.yaml"
- ))
+ source_dir, "_data", "categories.01", "dairy.yaml"
+ ))
assert_equal site.data["categories01"]["dairy"], file_content
assert_equal(
@@ -536,9 +534,9 @@ class TestSite < JekyllUnitTest
context "manipulating the Jekyll environment" do
setup do
- @site = Site.new(site_configuration({
- "incremental" => false,
- }))
+ @site = Site.new(site_configuration(
+ "incremental" => false
+ ))
@site.process
@page = @site.pages.find { |p| p.name == "environment.html" }
end
@@ -550,9 +548,9 @@ class TestSite < JekyllUnitTest
context "in production" do
setup do
ENV["JEKYLL_ENV"] = "production"
- @site = Site.new(site_configuration({
- "incremental" => false,
- }))
+ @site = Site.new(site_configuration(
+ "incremental" => false
+ ))
@site.process
@page = @site.pages.find { |p| p.name == "environment.html" }
end
@@ -571,13 +569,13 @@ class TestSite < JekyllUnitTest
should "set no theme if config is not set" do
expect($stderr).not_to receive(:puts)
expect($stdout).not_to receive(:puts)
- site = fixture_site({ "theme" => nil })
+ site = fixture_site("theme" => nil)
assert_nil site.theme
end
should "set no theme if config is a hash" do
output = capture_output do
- site = fixture_site({ "theme" => {} })
+ site = fixture_site("theme" => {})
assert_nil site.theme
end
expected_msg = "Theme: value of 'theme' in config should be String " \
@@ -589,7 +587,7 @@ class TestSite < JekyllUnitTest
[:debug, :info, :warn, :error].each do |level|
expect(Jekyll.logger.writer).not_to receive(level)
end
- site = fixture_site({ "theme" => "test-theme" })
+ site = fixture_site("theme" => "test-theme")
assert_instance_of Jekyll::Theme, site.theme
assert_equal "test-theme", site.theme.name
end
@@ -616,9 +614,9 @@ class TestSite < JekyllUnitTest
context "incremental build" do
setup do
- @site = Site.new(site_configuration({
- "incremental" => true,
- }))
+ @site = Site.new(site_configuration(
+ "incremental" => true
+ ))
@site.read
end
diff --git a/test/test_site_drop.rb b/test/test_site_drop.rb
index 43c52d70..01f3bed3 100644
--- a/test/test_site_drop.rb
+++ b/test/test_site_drop.rb
@@ -5,9 +5,9 @@ require "helper"
class TestSiteDrop < JekyllUnitTest
context "a site drop" do
setup do
- @site = fixture_site({
- "collections" => ["thanksgiving"],
- })
+ @site = fixture_site(
+ "collections" => ["thanksgiving"]
+ )
@site.process
@drop = @site.to_liquid.site
end
diff --git a/test/test_static_file.rb b/test/test_static_file.rb
index e306d2a2..96663bac 100644
--- a/test/test_static_file.rb
+++ b/test/test_static_file.rb
@@ -70,7 +70,7 @@ class TestStaticFile < JekyllUnitTest
"root",
"_foo/dir/subdir",
"file.html",
- { "output" => true }
+ "output" => true
)
assert_equal :foo, static_file.type
assert_equal "/foo/dir/subdir/file.html", static_file.url
@@ -82,7 +82,7 @@ class TestStaticFile < JekyllUnitTest
"root",
"_foo/dir/subdir",
"file.html",
- { "output" => true, "permalink" => "/:path/" }
+ "output" => true, "permalink" => "/:path/"
)
assert_equal :foo, static_file.type
assert_equal "/dir/subdir/file.html", static_file.url
@@ -92,7 +92,7 @@ class TestStaticFile < JekyllUnitTest
should "be writable by default" do
static_file = setup_static_file("root", "dir/subdir", "file.html")
assert(static_file.write?,
- "static_file.write? should return true by default")
+ "static_file.write? should return true by default")
end
should "use the _config.yml defaults to determine writability" do
@@ -107,8 +107,8 @@ class TestStaticFile < JekyllUnitTest
defaults
)
assert(!static_file.write?,
- "static_file.write? should return false when _config.yml sets " \
- "`published: false`")
+ "static_file.write? should return false when _config.yml sets " \
+ "`published: false`")
end
should "respect front matter defaults" do
diff --git a/test/test_tags.rb b/test/test_tags.rb
index 54b8e4b7..4141b13b 100644
--- a/test/test_tags.rb
+++ b/test/test_tags.rb
@@ -26,20 +26,20 @@ class TestTags < JekyllUnitTest
# rubocop:enable Metrics/AbcSize
def fill_post(code, override = {})
- content = < This is not yet highlighted This should not be highlighted, right? This is not yet highlighted This should not be highlighted, right?1
-
test
1
+
test