Unit test for Configuration#stringify_keys

This commit is contained in:
Parker Moore 2013-04-12 21:56:45 +02:00
parent f2f20d18f0
commit 0c0b13e69b
1 changed files with 24 additions and 0 deletions

View File

@ -1,6 +1,30 @@
require 'helper' require 'helper'
class TestConfiguration < Test::Unit::TestCase class TestConfiguration < Test::Unit::TestCase
context "#stringify_keys" do
setup do
@mixed_keys = Configuration[{
'markdown' => 'maruku',
:permalink => 'date',
'baseurl' => '/',
:include => ['.htaccess'],
:source => './'
}]
@string_keys = Configuration[{
'markdown' => 'maruku',
'permalink' => 'date',
'baseurl' => '/',
'include' => ['.htaccess'],
'source' => './'
}]
end
should "stringify symbol keys" do
assert_equal @string_keys, @mixed_keys.stringify_keys
end
should "not mess with keys already strings" do
assert_equal @string_keys, @string_keys.stringify_keys
end
end
context "loading configuration" do context "loading configuration" do
setup do setup do
@path = File.join(Dir.pwd, '_config.yml') @path = File.join(Dir.pwd, '_config.yml')