Some weird stuff with Colorator on my machine & jruby.

This commit is contained in:
Parker Moore 2016-06-28 14:39:06 -07:00
parent 89c6b0ec0d
commit 2ef70fd348
No known key found for this signature in database
GPG Key ID: 193CDEBA72063C58
1 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,5 @@
require "helper" require "helper"
require "colorator"
class TestConfiguration < JekyllUnitTest class TestConfiguration < JekyllUnitTest
test_config = { test_config = {
@ -260,7 +261,9 @@ class TestConfiguration < JekyllUnitTest
allow(SafeYAML).to receive(:load_file).with(@path) do allow(SafeYAML).to receive(:load_file).with(@path) do
raise SystemCallError, "No such file or directory - #{@path}" raise SystemCallError, "No such file or directory - #{@path}"
end end
allow($stderr).to receive(:puts).with("Configuration file: none".yellow) allow($stderr).to receive(:puts).with(
Colorator.yellow("Configuration file: none")
)
assert_equal site_configuration, Jekyll.configuration(test_config) assert_equal site_configuration, Jekyll.configuration(test_config)
end end
@ -275,13 +278,12 @@ class TestConfiguration < JekyllUnitTest
allow($stderr) allow($stderr)
.to receive(:puts) .to receive(:puts)
.and_return( .and_return(
("WARNING: " "WARNING: ".rjust(20) +
.rjust(20) + "Error reading configuration. Using defaults (and options).") Colorator.yellow("Error reading configuration. Using defaults (and options).")
.yellow
) )
allow($stderr) allow($stderr)
.to receive(:puts) .to receive(:puts)
.and_return("Configuration file: (INVALID) #{@path}".yellow) .and_return(Colorator.yellow("Configuration file: (INVALID) #{@path}"))
assert_equal site_configuration, Jekyll.configuration(test_config) assert_equal site_configuration, Jekyll.configuration(test_config)
end end
@ -291,10 +293,10 @@ class TestConfiguration < JekyllUnitTest
end end
allow($stderr) allow($stderr)
.to receive(:puts) .to receive(:puts)
.with(( .with(Colorator.red(
"Fatal: ".rjust(20) + \ "Fatal: ".rjust(20) + \
"The configuration file '#{@user_config}' could not be found." "The configuration file '#{@user_config}' could not be found."
).red) ))
assert_raises LoadError do assert_raises LoadError do
Jekyll.configuration({ "config" => [@user_config] }) Jekyll.configuration({ "config" => [@user_config] })
end end