Skip to content

Commit

Permalink
More testing, whitespace and comment cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
simensen committed Jan 23, 2012
1 parent dcf5462 commit e6d89c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/jekyll/site.rb
Expand Up @@ -14,17 +14,18 @@ class Site
# config - A Hash containing site configuration details.
def initialize(config)
self.config = config.clone

self.safe = config['safe']
self.source = File.expand_path(config['source'])
self.dest = File.expand_path(config['destination'])
self.plugins = if config['plugins'].respond_to?('each')
# If plugins is an array, process it.
Array(config['plugins']).map { |d| File.expand_path(d) }
else
# Otherwise process a single entry as an array.
if config['plugins'].nil?
[]
else
# Otherwise process a single entry as an array.
[File.expand_path(config['plugins'])]
end
end
Expand Down
7 changes: 6 additions & 1 deletion test/test_site.rb
Expand Up @@ -17,10 +17,15 @@ class TestSite < Test::Unit::TestCase
assert_equal ['/tmp/plugins', '/tmp/otherplugins'], site.plugins
end

should "have an array for plugins if nothing is passed" do
should "have an empty array for plugins if nothing is passed" do
site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => []}))
assert_equal [], site.plugins
end

should "have an empty array for plugins if nil is passed" do
site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => nil}))
assert_equal [], site.plugins
end
end
context "creating sites" do
setup do
Expand Down

0 comments on commit e6d89c6

Please sign in to comment.