mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Merge branch 'master' into themes
* master: (58 commits) Update history to reflect merge of #4792 [ci skip] Update history to reflect merge of #4793 [ci skip] Update history to reflect merge of #4804 [ci skip] Update history to reflect merge of #4754 [ci skip] Update history to reflect merge of #4813 [ci skip] Added missing single quote on rsync client side command Add v3.0.4 and v3.1.3 to the history. Fixed typo Add jekyll-autoprefixer plugin Explicitly require Filters rather than implicitly. Update history to reflect merge of #4786 [ci skip] Update history to reflect merge of #4789 [ci skip] updates example domain in config template Globalize Jekyll's Filters. Update JRuby to 9.0.5.0; Drop the double digit test. Update Rack-Jekyll Heroku deployment blog post url convertible: use Document::YAML_FRONT_MATTER_REGEXP to parse transformable files Update history to reflect merge of #4734 [ci skip] Update history to reflect merge of #4478 [ci skip] Fix rubocop warning. ...
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
$stdout.puts "# -------------------------------------------------------------"
|
||||
$stdout.puts "# SPECS AND TESTS ARE RUNNING WITH WARNINGS OFF."
|
||||
$stdout.puts "# SEE: https://github.com/Shopify/liquid/issues/730"
|
||||
$stdout.puts "# SEE: https://github.com/jekyll/jekyll/issues/4719"
|
||||
$stdout.puts "# -------------------------------------------------------------"
|
||||
$VERBOSE = nil
|
||||
|
||||
def jruby?
|
||||
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
||||
end
|
||||
|
||||
@@ -110,7 +110,7 @@ class TestCommandsServe < JekyllUnitTest
|
||||
"ssl_key" => "bar"
|
||||
})
|
||||
|
||||
assert result[:EnableSSL]
|
||||
assert result[:SSLEnable]
|
||||
assert_equal result[:SSLPrivateKey ], "c2"
|
||||
assert_equal result[:SSLCertificate], "c1"
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ class TestConvertible < JekyllUnitTest
|
||||
out = capture_stderr do
|
||||
@convertible.read_yaml(@base, 'exploit_front_matter.erb')
|
||||
end
|
||||
refute_match /undefined class\/module DoesNotExist/, out
|
||||
refute_match(/undefined class\/module DoesNotExist/, out)
|
||||
end
|
||||
|
||||
should "not parse if there is encoding error in file" do
|
||||
|
||||
@@ -158,7 +158,7 @@ class TestFilters < JekyllUnitTest
|
||||
end
|
||||
|
||||
should "format a time with xmlschema" do
|
||||
assert_match /2014-05-10T00:10:07/, @filter.date_to_xmlschema(@time_as_numeric)
|
||||
assert_match(/2014-05-10T00:10:07/, @filter.date_to_xmlschema(@time_as_numeric))
|
||||
end
|
||||
|
||||
should "format a time according to RFC-822" do
|
||||
@@ -354,6 +354,64 @@ class TestFilters < JekyllUnitTest
|
||||
end
|
||||
end
|
||||
|
||||
context "where_exp filter" do
|
||||
should "return any input that is not an array" do
|
||||
assert_equal "some string", @filter.where_exp("some string", "la", "le")
|
||||
end
|
||||
|
||||
should "filter objects in a hash appropriately" do
|
||||
hash = {"a"=>{"color"=>"red"}, "b"=>{"color"=>"blue"}}
|
||||
assert_equal 1, @filter.where_exp(hash, "item", "item.color == 'red'").length
|
||||
assert_equal [{"color"=>"red"}], @filter.where_exp(hash, "item", "item.color == 'red'")
|
||||
end
|
||||
|
||||
should "filter objects appropriately" do
|
||||
assert_equal 2, @filter.where_exp(@array_of_objects, "item", "item.color == 'red'").length
|
||||
end
|
||||
|
||||
should "stringify during comparison for compatibility with liquid parsing" do
|
||||
hash = {
|
||||
"The Words" => {"rating" => 1.2, "featured" => false},
|
||||
"Limitless" => {"rating" => 9.2, "featured" => true},
|
||||
"Hustle" => {"rating" => 4.7, "featured" => true},
|
||||
}
|
||||
|
||||
results = @filter.where_exp(hash, "item", "item.featured == true")
|
||||
assert_equal 2, results.length
|
||||
assert_equal 9.2, results[0]["rating"]
|
||||
assert_equal 4.7, results[1]["rating"]
|
||||
|
||||
results = @filter.where_exp(hash, "item", "item.rating == 4.7")
|
||||
assert_equal 1, results.length
|
||||
assert_equal 4.7, results[0]["rating"]
|
||||
end
|
||||
|
||||
should "filter with other operators" do
|
||||
assert_equal [3, 4, 5], @filter.where_exp([ 1, 2, 3, 4, 5 ], "n", "n >= 3")
|
||||
end
|
||||
|
||||
objects = [
|
||||
{ "id" => "a", "groups" => [1, 2] },
|
||||
{ "id" => "b", "groups" => [2, 3] },
|
||||
{ "id" => "c" },
|
||||
{ "id" => "d", "groups" => [1, 3] }
|
||||
]
|
||||
should "filter with the contains operator over arrays" do
|
||||
results = @filter.where_exp(objects, "obj", "obj.groups contains 1")
|
||||
assert_equal 2, results.length
|
||||
assert_equal "a", results[0]["id"]
|
||||
assert_equal "d", results[1]["id"]
|
||||
end
|
||||
|
||||
should "filter with the contains operator over hash keys" do
|
||||
results = @filter.where_exp(objects, "obj", "obj contains 'groups'")
|
||||
assert_equal 3, results.length
|
||||
assert_equal "a", results[0]["id"]
|
||||
assert_equal "b", results[1]["id"]
|
||||
assert_equal "d", results[2]["id"]
|
||||
end
|
||||
end
|
||||
|
||||
context "sort filter" do
|
||||
should "raise Exception when input is nil" do
|
||||
err = assert_raises ArgumentError do
|
||||
|
||||
@@ -91,7 +91,7 @@ class TestNewCommand < JekyllUnitTest
|
||||
should 'force created folder' do
|
||||
capture_stdout { Jekyll::Commands::New.process(@args) }
|
||||
output = capture_stdout { Jekyll::Commands::New.process(@args, '--force') }
|
||||
assert_match /New jekyll site installed in/, output
|
||||
assert_match(/New jekyll site installed in/, output)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -232,13 +232,13 @@ class TestSite < JekyllUnitTest
|
||||
context 'error handling' do
|
||||
should "raise if destination is included in source" do
|
||||
assert_raises Jekyll::Errors::FatalException do
|
||||
site = Site.new(site_configuration('destination' => source_dir))
|
||||
Site.new(site_configuration('destination' => source_dir))
|
||||
end
|
||||
end
|
||||
|
||||
should "raise if destination is source" do
|
||||
assert_raises Jekyll::Errors::FatalException do
|
||||
site = Site.new(site_configuration('destination' => File.join(source_dir, "..")))
|
||||
Site.new(site_configuration('destination' => File.join(source_dir, "..")))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -520,7 +520,6 @@ class TestSite < JekyllUnitTest
|
||||
contacts_html = @site.pages.find { |p| p.name == "contacts.html" }
|
||||
@site.process
|
||||
|
||||
source = @site.in_source_dir(contacts_html.path)
|
||||
dest = File.expand_path(contacts_html.destination(@site.dest))
|
||||
mtime1 = File.stat(dest).mtime.to_i # first run must generate dest file
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ CONTENT
|
||||
end
|
||||
|
||||
should "not cause a markdown error" do
|
||||
refute_match /markdown\-html\-error/, @result
|
||||
refute_match(/markdown\-html\-error/, @result)
|
||||
end
|
||||
|
||||
should "render markdown with pygments" do
|
||||
@@ -442,7 +442,7 @@ CONTENT
|
||||
end
|
||||
|
||||
should "not cause an error" do
|
||||
refute_match /markdown\-html\-error/, @result
|
||||
refute_match(/markdown\-html\-error/, @result)
|
||||
end
|
||||
|
||||
should "have the url to the \"complex\" post from 2008-11-21" do
|
||||
@@ -466,7 +466,7 @@ CONTENT
|
||||
end
|
||||
|
||||
should "not cause an error" do
|
||||
refute_match /markdown\-html\-error/, @result
|
||||
refute_match(/markdown\-html\-error/, @result)
|
||||
end
|
||||
|
||||
should "have the url to the \"complex\" post from 2008-11-21" do
|
||||
@@ -600,7 +600,8 @@ title: Include symlink
|
||||
CONTENT
|
||||
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
||||
end
|
||||
refute_match /SYMLINK TEST/, @result
|
||||
@result ||= ''
|
||||
refute_match(/SYMLINK TEST/, @result)
|
||||
end
|
||||
|
||||
should "not expose the existence of symlinked files" do
|
||||
@@ -877,7 +878,8 @@ title: Include symlink
|
||||
CONTENT
|
||||
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
||||
end
|
||||
refute_match /SYMLINK TEST/, @result
|
||||
@result ||= ''
|
||||
refute_match(/SYMLINK TEST/, @result)
|
||||
end
|
||||
|
||||
should "not expose the existence of symlinked files" do
|
||||
|
||||
@@ -63,12 +63,12 @@ class TestURL < JekyllUnitTest
|
||||
},
|
||||
})
|
||||
site.read
|
||||
doc = site.collections["methods"].docs.find do |doc|
|
||||
matching_doc = site.collections["methods"].docs.find do |doc|
|
||||
doc.relative_path == "_methods/escape-+ #%20[].md"
|
||||
end
|
||||
assert_equal '/methods/escape-+-20/escape-20.html', URL.new(
|
||||
:template => '/methods/:title/:name:output_ext',
|
||||
:placeholders => doc.url_placeholders
|
||||
:placeholders => matching_doc.url_placeholders
|
||||
).to_s
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user