Stubbing out the configuration makes for much less warnings.
This commit is contained in:
parent
ab262a2ab5
commit
c60be9c571
|
@ -11,7 +11,11 @@ class Test::Unit::TestCase
|
||||||
include RR::Adapters::TestUnit
|
include RR::Adapters::TestUnit
|
||||||
|
|
||||||
def dest_dir
|
def dest_dir
|
||||||
File.join(File.dirname(__FILE__), *%w[dest])
|
File.join(File.dirname(__FILE__), 'dest')
|
||||||
|
end
|
||||||
|
|
||||||
|
def source_dir
|
||||||
|
File.join(File.dirname(__FILE__), 'source')
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear_dest
|
def clear_dest
|
||||||
|
|
|
@ -4,9 +4,11 @@ class TestGeneratedSite < Test::Unit::TestCase
|
||||||
context "generated sites" do
|
context "generated sites" do
|
||||||
setup do
|
setup do
|
||||||
clear_dest
|
clear_dest
|
||||||
@source = File.join(File.dirname(__FILE__), *%w[source])
|
stub(Jekyll).configuration do
|
||||||
@configuration = Jekyll.configuration 'source' => @source, 'destination' => dest_dir
|
Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
|
||||||
@site = Site.new(@configuration)
|
end
|
||||||
|
|
||||||
|
@site = Site.new(Jekyll.configuration)
|
||||||
@site.process
|
@site.process
|
||||||
@index = File.read(File.join(dest_dir, 'index.html'))
|
@index = File.read(File.join(dest_dir, 'index.html'))
|
||||||
end
|
end
|
||||||
|
@ -16,9 +18,8 @@ class TestGeneratedSite < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "render post.content" do
|
should "render post.content" do
|
||||||
latest_post = Dir[File.join(@source, '_posts/*')].last
|
latest_post = Dir[File.join(source_dir, '_posts/*')].last
|
||||||
post = Post.new(@site, @source, '', File.basename(latest_post))
|
post = Post.new(@site, source_dir, '', File.basename(latest_post))
|
||||||
#Jekyll.content_type = post.determine_content_type
|
|
||||||
post.transform
|
post.transform
|
||||||
assert @index.include?(post.content)
|
assert @index.include?(post.content)
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
class TestPost < Test::Unit::TestCase
|
class TestPost < Test::Unit::TestCase
|
||||||
def setup_post(file)
|
def setup_post(file)
|
||||||
Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), '', file)
|
Post.new(@site, File.join(File.dirname(__FILE__), 'source'), '', file)
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_render(post)
|
def do_render(post)
|
||||||
|
|
|
@ -3,10 +3,10 @@ require File.dirname(__FILE__) + '/helper'
|
||||||
class TestSite < Test::Unit::TestCase
|
class TestSite < Test::Unit::TestCase
|
||||||
context "creating sites" do
|
context "creating sites" do
|
||||||
setup do
|
setup do
|
||||||
@source = File.join(File.dirname(__FILE__), 'source')
|
stub(Jekyll).configuration do
|
||||||
@configuration = Jekyll.configuration(:source => @source, :destination => dest_dir)
|
Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
|
||||||
|
end
|
||||||
@s = Site.new(@configuration)
|
@site = Site.new(Jekyll.configuration)
|
||||||
end
|
end
|
||||||
|
|
||||||
#should "read layouts" do
|
#should "read layouts" do
|
||||||
|
@ -37,8 +37,8 @@ class TestSite < Test::Unit::TestCase
|
||||||
.baz.markdow foo.markdown~]
|
.baz.markdow foo.markdown~]
|
||||||
ent2 = %w[.htaccess _posts bla.bla]
|
ent2 = %w[.htaccess _posts bla.bla]
|
||||||
|
|
||||||
assert_equal %w[foo.markdown bar.markdown baz.markdown], @s.filter_entries(ent1)
|
assert_equal %w[foo.markdown bar.markdown baz.markdown], @site.filter_entries(ent1)
|
||||||
assert_equal ent2, @s.filter_entries(ent2)
|
assert_equal ent2, @site.filter_entries(ent2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue