Updating tests for safe_yaml.
This commit is contained in:
parent
11eb1ecae1
commit
c7c0a9432c
|
@ -7,20 +7,20 @@ class TestConfiguration < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "fire warning with no _config.yml" do
|
should "fire warning with no _config.yml" do
|
||||||
mock(YAML).load_file(@path) { raise "No such file or directory - #{@path}" }
|
mock(YAML).safe_load_file(@path) { raise "No such file or directory - #{@path}" }
|
||||||
mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).")
|
mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).")
|
||||||
mock($stderr).puts("\tNo such file or directory - #{@path}")
|
mock($stderr).puts("\tNo such file or directory - #{@path}")
|
||||||
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({})
|
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({})
|
||||||
end
|
end
|
||||||
|
|
||||||
should "load configuration as hash" do
|
should "load configuration as hash" do
|
||||||
mock(YAML).load_file(@path) { Hash.new }
|
mock(YAML).safe_load_file(@path) { Hash.new }
|
||||||
mock($stdout).puts("Configuration from #{@path}")
|
mock($stdout).puts("Configuration from #{@path}")
|
||||||
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({})
|
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({})
|
||||||
end
|
end
|
||||||
|
|
||||||
should "fire warning with bad config" do
|
should "fire warning with bad config" do
|
||||||
mock(YAML).load_file(@path) { Array.new }
|
mock(YAML).safe_load_file(@path) { Array.new }
|
||||||
mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).")
|
mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).")
|
||||||
mock($stderr).puts("\tInvalid configuration - #{@path}")
|
mock($stderr).puts("\tInvalid configuration - #{@path}")
|
||||||
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({})
|
assert_equal Jekyll::DEFAULTS, Jekyll.configuration({})
|
||||||
|
|
Loading…
Reference in New Issue