diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb index fc39c08f..dfe23991 100644 --- a/lib/jekyll/tags/include.rb +++ b/lib/jekyll/tags/include.rb @@ -11,7 +11,7 @@ module Jekyll return "Include file '#{@file}' contains invalid characters or sequences" end - Dir.chdir(File.join('.', '_includes')) do + Dir.chdir(File.join('.', context.registers[:site].source, '_includes')) do choices = Dir['**/*'].reject { |x| File.symlink?(x) } if choices.include?(@file) source = File.read(@file) diff --git a/test/helper.rb b/test/helper.rb index 304f59c9..71d8d635 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -3,10 +3,13 @@ require File.join(File.dirname(__FILE__), *%w[.. lib jekyll]) require 'test/unit' require 'redgreen' require 'shoulda' +require 'rr' include Jekyll class Test::Unit::TestCase + include RR::Adapters::TestUnit + def dest_dir File.join(File.dirname(__FILE__), *%w[dest]) end diff --git a/test/test_post.rb b/test/test_post.rb index 4d8303ec..213089fe 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -13,9 +13,8 @@ class TestPost < Test::Unit::TestCase context "A Post" do setup do clear_dest - @source = File.join(File.dirname(__FILE__), *%w[source]) - @configuration = Jekyll.configuration 'source' => @source, 'destination' => dest_dir - @site = Site.new(@configuration) + stub(Jekyll).configuration { Jekyll::DEFAULTS } + @site = Site.new(Jekyll.configuration) end should "ensure valid posts are valid" do @@ -126,7 +125,7 @@ class TestPost < Test::Unit::TestCase assert_equal "<<<

url: /2008/11/21/complex.html
\ndate: #{Time.parse("2008-11-21")}
\nid: /2008/11/21/complex

>>>", post.output end - should_eventually "include templates" do + should "include templates" do post = setup_post("2008-12-13-include.markdown") post.site.source = File.join(File.dirname(__FILE__), 'source') do_render(post)