Merge pull request #3492 from jekyll/upgrade-tests
Upgrade tests to use Minitest
This commit is contained in:
commit
26acb3f9d9
3
Gemfile
3
Gemfile
|
@ -25,7 +25,8 @@ gem 'activesupport', '~> 3.2.13'
|
||||||
gem 'jekyll_test_plugin'
|
gem 'jekyll_test_plugin'
|
||||||
gem 'jekyll_test_plugin_malicious'
|
gem 'jekyll_test_plugin_malicious'
|
||||||
gem 'liquid-c', '~> 0.0.3'
|
gem 'liquid-c', '~> 0.0.3'
|
||||||
gem 'minitest' if RUBY_PLATFORM =~ /cygwin/
|
gem 'minitest'
|
||||||
|
gem 'minitest-reporters'
|
||||||
gem 'test-unit' if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
|
gem 'test-unit' if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
|
||||||
|
|
||||||
if ENV['BENCHMARK']
|
if ENV['BENCHMARK']
|
||||||
|
|
|
@ -27,7 +27,7 @@ After do
|
||||||
Dir.chdir(File.dirname(TEST_DIR))
|
Dir.chdir(File.dirname(TEST_DIR))
|
||||||
end
|
end
|
||||||
|
|
||||||
World(Test::Unit::Assertions)
|
World(Minitest::Assertions)
|
||||||
|
|
||||||
Given /^I have a blank site in "(.*)"$/ do |path|
|
Given /^I have a blank site in "(.*)"$/ do |path|
|
||||||
FileUtils.mkdir_p(path) unless File.exist?(path)
|
FileUtils.mkdir_p(path) unless File.exist?(path)
|
||||||
|
@ -191,7 +191,7 @@ Then /^I should see exactly "(.*)" in "(.*)"$/ do |text, file|
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
|
Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
|
||||||
assert_no_match Regexp.new(text, Regexp::MULTILINE), file_contents(file)
|
refute_match Regexp.new(text, Regexp::MULTILINE), file_contents(file)
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
|
Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'posix-spawn'
|
require 'posix-spawn'
|
||||||
require 'rr'
|
require 'rr'
|
||||||
require 'test/unit'
|
require 'minitest/assertions'
|
||||||
require 'time'
|
require 'time'
|
||||||
|
|
||||||
JEKYLL_SOURCE_DIR = File.dirname(File.dirname(File.dirname(__FILE__)))
|
JEKYLL_SOURCE_DIR = File.dirname(File.dirname(File.dirname(__FILE__)))
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require 'set'
|
require 'set'
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
class Site
|
|
||||||
# Handles the cleanup of a site's destination before it is built.
|
# Handles the cleanup of a site's destination before it is built.
|
||||||
class Cleaner
|
class Cleaner
|
||||||
attr_reader :site
|
attr_reader :site
|
||||||
|
@ -100,4 +99,3 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
|
@ -8,6 +8,10 @@ if [ ! -d tmp ]; then
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -d test/dest ]; then
|
||||||
|
rm -r test/dest
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
TEST_FILES=$(ruby -e "puts Dir.glob('test/test_*.rb')")
|
TEST_FILES=$(ruby -e "puts Dir.glob('test/test_*.rb')")
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,8 +6,9 @@ SimpleCov.start('gem') do
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'test/unit'
|
|
||||||
require 'ostruct'
|
require 'ostruct'
|
||||||
|
require 'minitest/autorun'
|
||||||
|
require 'minitest/reporters'
|
||||||
|
|
||||||
require 'jekyll'
|
require 'jekyll'
|
||||||
|
|
||||||
|
@ -23,9 +24,10 @@ include Jekyll
|
||||||
# Send STDERR into the void to suppress program output messages
|
# Send STDERR into the void to suppress program output messages
|
||||||
STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:')
|
STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:')
|
||||||
|
|
||||||
class Test::Unit::TestCase
|
# Report with color.
|
||||||
include RR::Adapters::TestUnit
|
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
||||||
|
|
||||||
|
class JekyllUnitTest < Minitest::Test
|
||||||
def fixture_site(overrides = {})
|
def fixture_site(overrides = {})
|
||||||
Jekyll::Site.new(site_configuration(overrides))
|
Jekyll::Site.new(site_configuration(overrides))
|
||||||
end
|
end
|
||||||
|
@ -35,7 +37,10 @@ class Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def site_configuration(overrides = {})
|
def site_configuration(overrides = {})
|
||||||
full_overrides = build_configs(overrides, build_configs({"destination" => dest_dir}))
|
full_overrides = build_configs(overrides, build_configs({
|
||||||
|
"destination" => dest_dir,
|
||||||
|
"full_rebuild" => true
|
||||||
|
}))
|
||||||
build_configs({
|
build_configs({
|
||||||
"source" => source_dir
|
"source" => source_dir
|
||||||
}, full_overrides)
|
}, full_overrides)
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
require 'rubygems'
|
|
||||||
gem 'test-unit'
|
|
||||||
require 'test/unit'
|
|
||||||
|
|
||||||
# for some reason these tests fail when run via TextMate
|
|
||||||
# but succeed when run on the command line.
|
|
||||||
|
|
||||||
tests = Dir[File.expand_path("#{File.dirname(__FILE__)}/test_*.rb")]
|
|
||||||
tests.each do |file|
|
|
||||||
require file
|
|
||||||
end
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestCleaner < Test::Unit::TestCase
|
class TestCleaner < JekyllUnitTest
|
||||||
context "directory in keep_files" do
|
context "directory in keep_files" do
|
||||||
setup do
|
setup do
|
||||||
clear_dest
|
clear_dest
|
||||||
|
@ -12,7 +12,7 @@ class TestCleaner < Test::Unit::TestCase
|
||||||
@site = fixture_site
|
@site = fixture_site
|
||||||
@site.keep_files = ['to_keep/child_dir']
|
@site.keep_files = ['to_keep/child_dir']
|
||||||
|
|
||||||
@cleaner = Site::Cleaner.new(@site)
|
@cleaner = Cleaner.new(@site)
|
||||||
@cleaner.cleanup!
|
@cleaner.cleanup!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class TestCleaner < Test::Unit::TestCase
|
||||||
@site = fixture_site
|
@site = fixture_site
|
||||||
@site.process
|
@site.process
|
||||||
|
|
||||||
@cleaner = Site::Cleaner.new(@site)
|
@cleaner = Cleaner.new(@site)
|
||||||
@cleaner.cleanup!
|
@cleaner.cleanup!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestCoffeeScript < Test::Unit::TestCase
|
class TestCoffeeScript < JekyllUnitTest
|
||||||
context "converting CoffeeScript" do
|
context "converting CoffeeScript" do
|
||||||
setup do
|
setup do
|
||||||
External.require_with_graceful_fail('jekyll-coffeescript')
|
External.require_with_graceful_fail('jekyll-coffeescript')
|
||||||
|
@ -19,16 +19,16 @@ class TestCoffeeScript < Test::Unit::TestCase
|
||||||
return square(x) * x;
|
return square(x) * x;
|
||||||
};
|
};
|
||||||
cubes = (function() {
|
cubes = (function() {
|
||||||
var _i, _len, _results;
|
var i, len, results;
|
||||||
_results = [];
|
results = [];
|
||||||
for (_i = 0, _len = list.length; _i < _len; _i++) {
|
for (i = 0, len = list.length; i < len; i++) {
|
||||||
num = list[_i];
|
num = list[i];
|
||||||
_results.push(math.cube(num));
|
results.push(math.cube(num));
|
||||||
}
|
}
|
||||||
return _results;
|
return results;
|
||||||
})();
|
})();
|
||||||
if (typeof elvis !== \"undefined\" && elvis !== null) {
|
if (typeof elvis !== "undefined" && elvis !== null) {
|
||||||
return alert(\"I knew it!\");
|
return alert("I knew it!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestCollections < Test::Unit::TestCase
|
class TestCollections < JekyllUnitTest
|
||||||
context "an evil collection" do
|
context "an evil collection" do
|
||||||
setup do
|
setup do
|
||||||
@collection = Jekyll::Collection.new(fixture_site, "../../etc/password")
|
@collection = Jekyll::Collection.new(fixture_site, "../../etc/password")
|
||||||
|
@ -114,7 +114,7 @@ class TestCollections < Test::Unit::TestCase
|
||||||
|
|
||||||
should "create a Hash on Site with the label mapped to the instance of the Collection" do
|
should "create a Hash on Site with the label mapped to the instance of the Collection" do
|
||||||
assert @site.collections.is_a?(Hash)
|
assert @site.collections.is_a?(Hash)
|
||||||
assert_not_nil @site.collections["methods"]
|
refute_nil @site.collections["methods"]
|
||||||
assert @site.collections["methods"].is_a? Jekyll::Collection
|
assert @site.collections["methods"].is_a? Jekyll::Collection
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class TestCollections < Test::Unit::TestCase
|
||||||
assert @site.collections["methods"].docs.is_a? Array
|
assert @site.collections["methods"].docs.is_a? Array
|
||||||
@site.collections["methods"].docs.each do |doc|
|
@site.collections["methods"].docs.each do |doc|
|
||||||
assert doc.is_a? Jekyll::Document
|
assert doc.is_a? Jekyll::Document
|
||||||
assert_include %w[
|
assert_includes %w[
|
||||||
_methods/configuration.md
|
_methods/configuration.md
|
||||||
_methods/sanitized_path.md
|
_methods/sanitized_path.md
|
||||||
_methods/site/generate.md
|
_methods/site/generate.md
|
||||||
|
@ -135,16 +135,16 @@ class TestCollections < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not include files which start with an underscore in the base collection directory" do
|
should "not include files which start with an underscore in the base collection directory" do
|
||||||
assert_not_include @collection.filtered_entries, "_do_not_read_me.md"
|
refute_includes @collection.filtered_entries, "_do_not_read_me.md"
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not include files which start with an underscore in a subdirectory" do
|
should "not include files which start with an underscore in a subdirectory" do
|
||||||
assert_not_include @collection.filtered_entries, "site/_dont_include_me_either.md"
|
refute_includes @collection.filtered_entries, "site/_dont_include_me_either.md"
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not include the underscored files in the list of docs" do
|
should "not include the underscored files in the list of docs" do
|
||||||
assert_not_include @collection.docs.map(&:relative_path), "_methods/_do_not_read_me.md"
|
refute_includes @collection.docs.map(&:relative_path), "_methods/_do_not_read_me.md"
|
||||||
assert_not_include @collection.docs.map(&:relative_path), "_methods/site/_dont_include_me_either.md"
|
refute_includes @collection.docs.map(&:relative_path), "_methods/site/_dont_include_me_either.md"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -178,12 +178,12 @@ class TestCollections < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not allow symlinks" do
|
should "not allow symlinks" do
|
||||||
assert_not_include @collection.filtered_entries, "um_hi.md"
|
refute_includes @collection.filtered_entries, "um_hi.md"
|
||||||
assert_not_include @collection.filtered_entries, "/um_hi.md"
|
refute_includes @collection.filtered_entries, "/um_hi.md"
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not include the symlinked file in the list of docs" do
|
should "not include the symlinked file in the list of docs" do
|
||||||
assert_not_include @collection.docs.map(&:relative_path), "_methods/um_hi.md"
|
refute_includes @collection.docs.map(&:relative_path), "_methods/um_hi.md"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ class TestCollections < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "exist" do
|
should "exist" do
|
||||||
assert_not_nil @collection
|
refute_nil @collection
|
||||||
end
|
end
|
||||||
|
|
||||||
should "contain one document" do
|
should "contain one document" do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestCommand < Test::Unit::TestCase
|
class TestCommand < JekyllUnitTest
|
||||||
context "when calling .add_build_options" do
|
context "when calling .add_build_options" do
|
||||||
should "add common options" do
|
should "add common options" do
|
||||||
cmd = Object.new
|
cmd = Object.new
|
||||||
|
@ -13,8 +13,8 @@ class TestCommand < Test::Unit::TestCase
|
||||||
should "exit with non-zero error code" do
|
should "exit with non-zero error code" do
|
||||||
site = Object.new
|
site = Object.new
|
||||||
stub(site).process { raise Jekyll::Errors::FatalException }
|
stub(site).process { raise Jekyll::Errors::FatalException }
|
||||||
error = assert_raise(SystemExit) { Command.process_site(site) }
|
error = assert_raises(SystemExit) { Command.process_site(site) }
|
||||||
assert_not_equal 0, error.status
|
refute_equal 0, error.status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestConfiguration < Test::Unit::TestCase
|
class TestConfiguration < JekyllUnitTest
|
||||||
context "#stringify_keys" do
|
context "#stringify_keys" do
|
||||||
setup do
|
setup do
|
||||||
@mixed_keys = Configuration[{
|
@mixed_keys = Configuration[{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
require 'ostruct'
|
require 'ostruct'
|
||||||
|
|
||||||
class TestConvertible < Test::Unit::TestCase
|
class TestConvertible < JekyllUnitTest
|
||||||
context "yaml front-matter" do
|
context "yaml front-matter" do
|
||||||
setup do
|
setup do
|
||||||
@convertible = OpenStruct.new(
|
@convertible = OpenStruct.new(
|
||||||
|
@ -37,7 +37,7 @@ class TestConvertible < Test::Unit::TestCase
|
||||||
out = capture_stderr do
|
out = capture_stderr do
|
||||||
@convertible.read_yaml(@base, 'exploit_front_matter.erb')
|
@convertible.read_yaml(@base, 'exploit_front_matter.erb')
|
||||||
end
|
end
|
||||||
assert_no_match /undefined class\/module DoesNotExist/, out
|
refute_match /undefined class\/module DoesNotExist/, out
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not parse if there is encoding error in file" do
|
should "not parse if there is encoding error in file" do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestDocument < Test::Unit::TestCase
|
class TestDocument < JekyllUnitTest
|
||||||
|
|
||||||
context "a document in a collection" do
|
context "a document in a collection" do
|
||||||
setup do
|
setup do
|
||||||
|
@ -283,7 +283,7 @@ class TestDocument < Test::Unit::TestCase
|
||||||
|
|
||||||
context "without output overrides" do
|
context "without output overrides" do
|
||||||
should "be output according to collection defaults" do
|
should "be output according to collection defaults" do
|
||||||
assert_not_nil @files.find { |doc| doc.relative_path == "_slides/example-slide-4.html" }
|
refute_nil @files.find { |doc| doc.relative_path == "_slides/example-slide-4.html" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestDraft < Test::Unit::TestCase
|
class TestDraft < JekyllUnitTest
|
||||||
def setup_draft(file)
|
def setup_draft(file)
|
||||||
Draft.new(@site, source_dir, '', file)
|
Draft.new(@site, source_dir, '', file)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestEntryFilter < Test::Unit::TestCase
|
class TestEntryFilter < JekyllUnitTest
|
||||||
context "Filtering entries" do
|
context "Filtering entries" do
|
||||||
setup do
|
setup do
|
||||||
@site = Site.new(site_configuration)
|
@site = Site.new(site_configuration)
|
||||||
|
@ -71,8 +71,8 @@ class TestEntryFilter < Test::Unit::TestCase
|
||||||
site = Site.new(site_configuration)
|
site = Site.new(site_configuration)
|
||||||
|
|
||||||
site.read_directories("symlink-test")
|
site.read_directories("symlink-test")
|
||||||
assert_not_equal [], site.pages
|
refute_equal [], site.pages
|
||||||
assert_not_equal [], site.static_files
|
refute_equal [], site.static_files
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestExcerpt < Test::Unit::TestCase
|
class TestExcerpt < JekyllUnitTest
|
||||||
def setup_post(file)
|
def setup_post(file)
|
||||||
Post.new(@site, source_dir, '', file)
|
Post.new(@site, source_dir, '', file)
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestFilters < Test::Unit::TestCase
|
class TestFilters < JekyllUnitTest
|
||||||
class JekyllFilter
|
class JekyllFilter
|
||||||
include Jekyll::Filters
|
include Jekyll::Filters
|
||||||
attr_accessor :site, :context
|
attr_accessor :site, :context
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestFrontMatterDefaults < Test::Unit::TestCase
|
class TestFrontMatterDefaults < JekyllUnitTest
|
||||||
|
|
||||||
context "A site with full front matter defaults" do
|
context "A site with full front matter defaults" do
|
||||||
setup do
|
setup do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestGeneratedSite < Test::Unit::TestCase
|
class TestGeneratedSite < JekyllUnitTest
|
||||||
context "generated sites" do
|
context "generated sites" do
|
||||||
setup do
|
setup do
|
||||||
clear_dest
|
clear_dest
|
||||||
|
@ -73,7 +73,7 @@ OUTPUT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "ensure limit posts is 0 or more" do
|
should "ensure limit posts is 0 or more" do
|
||||||
assert_raise ArgumentError do
|
assert_raises ArgumentError do
|
||||||
clear_dest
|
clear_dest
|
||||||
stub(Jekyll).configuration do
|
stub(Jekyll).configuration do
|
||||||
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => -1})
|
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => -1})
|
||||||
|
@ -84,14 +84,12 @@ OUTPUT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "acceptable limit post is 0" do
|
should "acceptable limit post is 0" do
|
||||||
assert_nothing_raised ArgumentError do
|
|
||||||
clear_dest
|
clear_dest
|
||||||
stub(Jekyll).configuration do
|
stub(Jekyll).configuration do
|
||||||
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0})
|
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'limit_posts' => 0})
|
||||||
end
|
end
|
||||||
|
|
||||||
@site = Site.new(Jekyll.configuration)
|
assert Site.new(Jekyll.configuration), "Couldn't create a site with the given limit_posts."
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestKramdown < Test::Unit::TestCase
|
class TestKramdown < JekyllUnitTest
|
||||||
context "kramdown" do
|
context "kramdown" do
|
||||||
setup do
|
setup do
|
||||||
@config = {
|
@config = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestLayoutReader < Test::Unit::TestCase
|
class TestLayoutReader < JekyllUnitTest
|
||||||
context "reading layouts" do
|
context "reading layouts" do
|
||||||
setup do
|
setup do
|
||||||
stub(Jekyll).configuration do
|
stub(Jekyll).configuration do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestLiquidExtensions < Test::Unit::TestCase
|
class TestLiquidExtensions < JekyllUnitTest
|
||||||
|
|
||||||
context "looking up a variable in a Liquid context" do
|
context "looking up a variable in a Liquid context" do
|
||||||
class SayHi < Liquid::Tag
|
class SayHi < Liquid::Tag
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestLogAdapter < Test::Unit::TestCase
|
class TestLogAdapter < JekyllUnitTest
|
||||||
class LoggerDouble
|
class LoggerDouble
|
||||||
attr_accessor :level
|
attr_accessor :level
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class TestLogAdapter < Test::Unit::TestCase
|
||||||
should "call #error and abort" do
|
should "call #error and abort" do
|
||||||
logger = Jekyll::LogAdapter.new(LoggerDouble.new)
|
logger = Jekyll::LogAdapter.new(LoggerDouble.new)
|
||||||
stub(logger).error('topic', 'log message') { true }
|
stub(logger).error('topic', 'log message') { true }
|
||||||
assert_raise(SystemExit) { logger.abort_with('topic', 'log message') }
|
assert_raises(SystemExit) { logger.abort_with('topic', 'log message') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
require 'jekyll/commands/new'
|
require 'jekyll/commands/new'
|
||||||
|
|
||||||
class TestNewCommand < Test::Unit::TestCase
|
class TestNewCommand < JekyllUnitTest
|
||||||
def dir_contents(path)
|
def dir_contents(path)
|
||||||
Dir["#{path}/**/*"].each do |file|
|
Dir["#{path}/**/*"].each do |file|
|
||||||
file.gsub! path, ''
|
file.gsub! path, ''
|
||||||
|
@ -79,9 +79,8 @@ class TestNewCommand < Test::Unit::TestCase
|
||||||
|
|
||||||
should 'force created folder' do
|
should 'force created folder' do
|
||||||
capture_stdout { Jekyll::Commands::New.process(@args) }
|
capture_stdout { Jekyll::Commands::New.process(@args) }
|
||||||
assert_nothing_raised(SystemExit) do
|
output = capture_stdout { Jekyll::Commands::New.process(@args, '--force') }
|
||||||
capture_stdout {Jekyll::Commands::New.process(@args, '--force') }
|
assert_match /New jekyll site installed in/, output
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -108,7 +107,7 @@ class TestNewCommand < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should 'raise an ArgumentError' do
|
should 'raise an ArgumentError' do
|
||||||
exception = assert_raise ArgumentError do
|
exception = assert_raises ArgumentError do
|
||||||
Jekyll::Commands::New.process(@empty_args)
|
Jekyll::Commands::New.process(@empty_args)
|
||||||
end
|
end
|
||||||
assert_equal 'You must specify a path.', exception.message
|
assert_equal 'You must specify a path.', exception.message
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestPage < Test::Unit::TestCase
|
class TestPage < JekyllUnitTest
|
||||||
def setup_page(*args)
|
def setup_page(*args)
|
||||||
dir, file = args
|
dir, file = args
|
||||||
dir, file = ['', dir] if file.nil?
|
dir, file = ['', dir] if file.nil?
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestPathSanitization < Test::Unit::TestCase
|
class TestPathSanitization < JekyllUnitTest
|
||||||
context "on Windows with absolute source" do
|
context "on Windows with absolute source" do
|
||||||
setup do
|
setup do
|
||||||
@source = "C:/Users/xmr/Desktop/mpc-hc.org"
|
@source = "C:/Users/xmr/Desktop/mpc-hc.org"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestPluginManager < Test::Unit::TestCase
|
class TestPluginManager < JekyllUnitTest
|
||||||
def with_no_gemfile
|
def with_no_gemfile
|
||||||
FileUtils.mv "Gemfile", "Gemfile.old"
|
FileUtils.mv "Gemfile", "Gemfile.old"
|
||||||
yield
|
yield
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestPost < Test::Unit::TestCase
|
class TestPost < JekyllUnitTest
|
||||||
def setup_post(file)
|
def setup_post(file)
|
||||||
Post.new(@site, source_dir, '', file)
|
Post.new(@site, source_dir, '', file)
|
||||||
end
|
end
|
||||||
|
@ -103,7 +103,7 @@ class TestPost < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "raise a good error on invalid post date" do
|
should "raise a good error on invalid post date" do
|
||||||
assert_raise Jekyll::Errors::FatalException do
|
assert_raises Jekyll::Errors::FatalException do
|
||||||
@post.process("2009-27-03-foo-bar.textile")
|
@post.process("2009-27-03-foo-bar.textile")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestRdiscount < Test::Unit::TestCase
|
class TestRdiscount < JekyllUnitTest
|
||||||
|
|
||||||
context "rdiscount" do
|
context "rdiscount" do
|
||||||
setup do
|
setup do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestRedcarpet < Test::Unit::TestCase
|
class TestRedcarpet < JekyllUnitTest
|
||||||
context "redcarpet" do
|
context "redcarpet" do
|
||||||
setup do
|
setup do
|
||||||
@config = {
|
@config = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestRegenerator < Test::Unit::TestCase
|
class TestRegenerator < JekyllUnitTest
|
||||||
context "The site regenerator" do
|
context "The site regenerator" do
|
||||||
setup do
|
setup do
|
||||||
FileUtils.rm_rf(source_dir(".jekyll-metadata"))
|
FileUtils.rm_rf(source_dir(".jekyll-metadata"))
|
||||||
|
@ -10,7 +10,8 @@ class TestRegenerator < Test::Unit::TestCase
|
||||||
"methods" => {
|
"methods" => {
|
||||||
"output" => true
|
"output" => true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"full_rebuild" => false
|
||||||
})
|
})
|
||||||
|
|
||||||
@site.read
|
@site.read
|
||||||
|
@ -162,7 +163,7 @@ class TestRegenerator < Test::Unit::TestCase
|
||||||
@regenerator.write_metadata
|
@regenerator.write_metadata
|
||||||
@regenerator = Regenerator.new(@site)
|
@regenerator = Regenerator.new(@site)
|
||||||
|
|
||||||
assert_not_same File.mtime(@path), @regenerator.metadata[@path]["mtime"]
|
refute_same File.mtime(@path), @regenerator.metadata[@path]["mtime"]
|
||||||
assert @regenerator.modified?(@path)
|
assert @regenerator.modified?(@path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestRelatedPosts < Test::Unit::TestCase
|
class TestRelatedPosts < JekyllUnitTest
|
||||||
context "building related posts without lsi" do
|
context "building related posts without lsi" do
|
||||||
setup do
|
setup do
|
||||||
stub(Jekyll).configuration do
|
stub(Jekyll).configuration do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestSass < Test::Unit::TestCase
|
class TestSass < JekyllUnitTest
|
||||||
context "importing partials" do
|
context "importing partials" do
|
||||||
setup do
|
setup do
|
||||||
@site = Jekyll::Site.new(Jekyll.configuration({
|
@site = Jekyll::Site.new(Jekyll.configuration({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestSite < Test::Unit::TestCase
|
class TestSite < JekyllUnitTest
|
||||||
context "configuring sites" do
|
context "configuring sites" do
|
||||||
should "have an array for plugins by default" do
|
should "have an array for plugins by default" do
|
||||||
site = Site.new(Jekyll::Configuration::DEFAULTS)
|
site = Site.new(Jekyll::Configuration::DEFAULTS)
|
||||||
|
@ -71,7 +71,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
@site = Site.new(site_configuration)
|
@site = Site.new(site_configuration)
|
||||||
@site.read
|
@site.read
|
||||||
@site.generate
|
@site.generate
|
||||||
assert_not_equal 0, @site.pages.size
|
refute_equal 0, @site.pages.size
|
||||||
assert_equal 'hi', @site.file_read_opts[:secret_message]
|
assert_equal 'hi', @site.file_read_opts[:secret_message]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
sleep 1
|
sleep 1
|
||||||
@site.process
|
@site.process
|
||||||
mtime3 = File.stat(dest).mtime.to_i
|
mtime3 = File.stat(dest).mtime.to_i
|
||||||
assert_not_equal mtime2, mtime3 # must be regenerated!
|
refute_equal mtime2, mtime3 # must be regenerated!
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
@site.process
|
@site.process
|
||||||
|
@ -228,13 +228,13 @@ class TestSite < Test::Unit::TestCase
|
||||||
|
|
||||||
context 'error handling' do
|
context 'error handling' do
|
||||||
should "raise if destination is included in source" do
|
should "raise if destination is included in source" do
|
||||||
assert_raise Jekyll::Errors::FatalException do
|
assert_raises Jekyll::Errors::FatalException do
|
||||||
site = Site.new(site_configuration('destination' => source_dir))
|
site = Site.new(site_configuration('destination' => source_dir))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
should "raise if destination is source" do
|
should "raise if destination is source" do
|
||||||
assert_raise Jekyll::Errors::FatalException do
|
assert_raises Jekyll::Errors::FatalException do
|
||||||
site = Site.new(site_configuration('destination' => File.join(source_dir, "..")))
|
site = Site.new(site_configuration('destination' => File.join(source_dir, "..")))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -309,9 +309,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
|
|
||||||
custom_processor = "CustomMarkdown"
|
custom_processor = "CustomMarkdown"
|
||||||
s = Site.new(site_configuration('markdown' => custom_processor))
|
s = Site.new(site_configuration('markdown' => custom_processor))
|
||||||
assert_nothing_raised do
|
assert !!s.process
|
||||||
s.process
|
|
||||||
end
|
|
||||||
|
|
||||||
# Do some cleanup, we don't like straggling stuff's.
|
# Do some cleanup, we don't like straggling stuff's.
|
||||||
Jekyll::Converters::Markdown.send(:remove_const, :CustomMarkdown)
|
Jekyll::Converters::Markdown.send(:remove_const, :CustomMarkdown)
|
||||||
|
@ -332,7 +330,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
|
|
||||||
bad_processor = "Custom::Markdown"
|
bad_processor = "Custom::Markdown"
|
||||||
s = Site.new(site_configuration('markdown' => bad_processor, 'full_rebuild' => true))
|
s = Site.new(site_configuration('markdown' => bad_processor, 'full_rebuild' => true))
|
||||||
assert_raise Jekyll::Errors::FatalException do
|
assert_raises Jekyll::Errors::FatalException do
|
||||||
s.process
|
s.process
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -344,15 +342,13 @@ class TestSite < Test::Unit::TestCase
|
||||||
context 'with an invalid markdown processor in the configuration' do
|
context 'with an invalid markdown processor in the configuration' do
|
||||||
should 'not throw an error at initialization time' do
|
should 'not throw an error at initialization time' do
|
||||||
bad_processor = 'not a processor name'
|
bad_processor = 'not a processor name'
|
||||||
assert_nothing_raised do
|
assert Site.new(site_configuration('markdown' => bad_processor))
|
||||||
Site.new(site_configuration('markdown' => bad_processor))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
should 'throw FatalException at process time' do
|
should 'throw FatalException at process time' do
|
||||||
bad_processor = 'not a processor name'
|
bad_processor = 'not a processor name'
|
||||||
s = Site.new(site_configuration('markdown' => bad_processor, 'full_rebuild' => true))
|
s = Site.new(site_configuration('markdown' => bad_processor, 'full_rebuild' => true))
|
||||||
assert_raise Jekyll::Errors::FatalException do
|
assert_raises Jekyll::Errors::FatalException do
|
||||||
s.process
|
s.process
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestTags < Test::Unit::TestCase
|
class TestTags < JekyllUnitTest
|
||||||
|
|
||||||
def create_post(content, override = {}, converter_class = Jekyll::Converters::Markdown)
|
def create_post(content, override = {}, converter_class = Jekyll::Converters::Markdown)
|
||||||
stub(Jekyll).configuration do
|
stub(Jekyll).configuration do
|
||||||
|
@ -56,7 +56,7 @@ CONTENT
|
||||||
assert_match r, "x.y"
|
assert_match r, "x.y"
|
||||||
assert_match r, "coffee-script"
|
assert_match r, "coffee-script"
|
||||||
|
|
||||||
assert_no_match r, "blah^"
|
refute_match r, "blah^"
|
||||||
|
|
||||||
assert_match r, "ruby key=val"
|
assert_match r, "ruby key=val"
|
||||||
assert_match r, "ruby a=b c=d"
|
assert_match r, "ruby a=b c=d"
|
||||||
|
@ -143,7 +143,7 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not cause a markdown error" do
|
should "not cause a markdown error" do
|
||||||
assert_no_match /markdown\-html\-error/, @result
|
refute_match /markdown\-html\-error/, @result
|
||||||
end
|
end
|
||||||
|
|
||||||
should "render markdown with pygments" do
|
should "render markdown with pygments" do
|
||||||
|
@ -410,7 +410,7 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not cause an error" do
|
should "not cause an error" do
|
||||||
assert_no_match /markdown\-html\-error/, @result
|
refute_match /markdown\-html\-error/, @result
|
||||||
end
|
end
|
||||||
|
|
||||||
should "have the url to the \"complex\" post from 2008-11-21" do
|
should "have the url to the \"complex\" post from 2008-11-21" do
|
||||||
|
@ -434,7 +434,7 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not cause an error" do
|
should "not cause an error" do
|
||||||
assert_no_match /markdown\-html\-error/, @result
|
refute_match /markdown\-html\-error/, @result
|
||||||
end
|
end
|
||||||
|
|
||||||
should "have the url to the \"complex\" post from 2008-11-21" do
|
should "have the url to the \"complex\" post from 2008-11-21" do
|
||||||
|
@ -458,7 +458,7 @@ title: Invalid post name linking
|
||||||
{% post_url abc2008-11-21-complex %}
|
{% post_url abc2008-11-21-complex %}
|
||||||
CONTENT
|
CONTENT
|
||||||
|
|
||||||
assert_raise ArgumentError do
|
assert_raises ArgumentError do
|
||||||
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -470,7 +470,7 @@ CONTENT
|
||||||
|
|
||||||
should "not allow symlink includes" do
|
should "not allow symlink includes" do
|
||||||
File.open("tmp/pages-test", 'w') { |file| file.write("SYMLINK TEST") }
|
File.open("tmp/pages-test", 'w') { |file| file.write("SYMLINK TEST") }
|
||||||
assert_raise IOError do
|
assert_raises IOError do
|
||||||
content = <<CONTENT
|
content = <<CONTENT
|
||||||
---
|
---
|
||||||
title: Include symlink
|
title: Include symlink
|
||||||
|
@ -481,11 +481,11 @@ title: Include symlink
|
||||||
CONTENT
|
CONTENT
|
||||||
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
||||||
end
|
end
|
||||||
assert_no_match /SYMLINK TEST/, @result
|
refute_match /SYMLINK TEST/, @result
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not expose the existence of symlinked files" do
|
should "not expose the existence of symlinked files" do
|
||||||
ex = assert_raise IOError do
|
ex = assert_raises IOError do
|
||||||
content = <<CONTENT
|
content = <<CONTENT
|
||||||
---
|
---
|
||||||
title: Include symlink
|
title: Include symlink
|
||||||
|
@ -532,7 +532,7 @@ title: Invalid parameter syntax
|
||||||
|
|
||||||
{% include params.html param s="value" %}
|
{% include params.html param s="value" %}
|
||||||
CONTENT
|
CONTENT
|
||||||
assert_raise ArgumentError, 'Did not raise exception on invalid "include" syntax' do
|
assert_raises ArgumentError, 'Did not raise exception on invalid "include" syntax' do
|
||||||
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ title: Invalid parameter syntax
|
||||||
|
|
||||||
{% include params.html params="value %}
|
{% include params.html params="value %}
|
||||||
CONTENT
|
CONTENT
|
||||||
assert_raise ArgumentError, 'Did not raise exception on invalid "include" syntax' do
|
assert_raises ArgumentError, 'Did not raise exception on invalid "include" syntax' do
|
||||||
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -636,7 +636,7 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "raise error relative to source directory" do
|
should "raise error relative to source directory" do
|
||||||
exception = assert_raise IOError do
|
exception = assert_raises IOError do
|
||||||
create_post(@content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
create_post(@content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
||||||
end
|
end
|
||||||
assert_equal 'Included file \'_includes/missing.html\' not found', exception.message
|
assert_equal 'Included file \'_includes/missing.html\' not found', exception.message
|
||||||
|
@ -730,7 +730,7 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "raise error relative to source directory" do
|
should "raise error relative to source directory" do
|
||||||
exception = assert_raise IOError do
|
exception = assert_raises IOError do
|
||||||
create_post(@content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
create_post(@content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
||||||
end
|
end
|
||||||
assert_equal 'Included file \'./missing.html\' not found', exception.message
|
assert_equal 'Included file \'./missing.html\' not found', exception.message
|
||||||
|
@ -749,7 +749,7 @@ CONTENT
|
||||||
end
|
end
|
||||||
|
|
||||||
should "raise error relative to source directory" do
|
should "raise error relative to source directory" do
|
||||||
exception = assert_raise ArgumentError do
|
exception = assert_raises ArgumentError do
|
||||||
create_post(@content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
create_post(@content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
||||||
end
|
end
|
||||||
assert_equal "Invalid syntax for include tag. File contains invalid characters or sequences:\n\n ../README.markdown\n\nValid syntax:\n\n {% include_relative file.ext param='value' param2='value' %}\n\n", exception.message
|
assert_equal "Invalid syntax for include tag. File contains invalid characters or sequences:\n\n ../README.markdown\n\nValid syntax:\n\n {% include_relative file.ext param='value' param2='value' %}\n\n", exception.message
|
||||||
|
@ -761,7 +761,7 @@ CONTENT
|
||||||
|
|
||||||
should "not allow symlink includes" do
|
should "not allow symlink includes" do
|
||||||
File.open("tmp/pages-test", 'w') { |file| file.write("SYMLINK TEST") }
|
File.open("tmp/pages-test", 'w') { |file| file.write("SYMLINK TEST") }
|
||||||
assert_raise IOError do
|
assert_raises IOError do
|
||||||
content = <<CONTENT
|
content = <<CONTENT
|
||||||
---
|
---
|
||||||
title: Include symlink
|
title: Include symlink
|
||||||
|
@ -772,11 +772,11 @@ title: Include symlink
|
||||||
CONTENT
|
CONTENT
|
||||||
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
||||||
end
|
end
|
||||||
assert_no_match /SYMLINK TEST/, @result
|
refute_match /SYMLINK TEST/, @result
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not expose the existence of symlinked files" do
|
should "not expose the existence of symlinked files" do
|
||||||
ex = assert_raise IOError do
|
ex = assert_raises IOError do
|
||||||
content = <<CONTENT
|
content = <<CONTENT
|
||||||
---
|
---
|
||||||
title: Include symlink
|
title: Include symlink
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestURL < Test::Unit::TestCase
|
class TestURL < JekyllUnitTest
|
||||||
context "The URL class" do
|
context "The URL class" do
|
||||||
|
|
||||||
should "throw an exception if neither permalink or template is specified" do
|
should "throw an exception if neither permalink or template is specified" do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
class TestUtils < Test::Unit::TestCase
|
class TestUtils < JekyllUnitTest
|
||||||
context "hash" do
|
context "hash" do
|
||||||
|
|
||||||
context "pluralized_array" do
|
context "pluralized_array" do
|
||||||
|
@ -70,20 +70,20 @@ class TestUtils < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "throw an error if the input contains no date data" do
|
should "throw an error if the input contains no date data" do
|
||||||
assert_raise Jekyll::Errors::FatalException do
|
assert_raises Jekyll::Errors::FatalException do
|
||||||
Utils.parse_date("Blah")
|
Utils.parse_date("Blah")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
should "throw an error if the input is out of range" do
|
should "throw an error if the input is out of range" do
|
||||||
assert_raise Jekyll::Errors::FatalException do
|
assert_raises Jekyll::Errors::FatalException do
|
||||||
Utils.parse_date("9999-99-99")
|
Utils.parse_date("9999-99-99")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
should "throw an error with the default message if no message is passed in" do
|
should "throw an error with the default message if no message is passed in" do
|
||||||
date = "Blah this is invalid"
|
date = "Blah this is invalid"
|
||||||
assert_raise Jekyll::Errors::FatalException, "Invalid date '#{date}': Input could not be parsed." do
|
assert_raises Jekyll::Errors::FatalException, "Invalid date '#{date}': Input could not be parsed." do
|
||||||
Utils.parse_date(date)
|
Utils.parse_date(date)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -91,7 +91,7 @@ class TestUtils < Test::Unit::TestCase
|
||||||
should "throw an error with the provided message if a message is passed in" do
|
should "throw an error with the provided message if a message is passed in" do
|
||||||
date = "Blah this is invalid"
|
date = "Blah this is invalid"
|
||||||
message = "Aaaah, the world has exploded!"
|
message = "Aaaah, the world has exploded!"
|
||||||
assert_raise Jekyll::Errors::FatalException, "Invalid date '#{date}': #{message}" do
|
assert_raises Jekyll::Errors::FatalException, "Invalid date '#{date}': #{message}" do
|
||||||
Utils.parse_date(date, message)
|
Utils.parse_date(date, message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue