Created
November 28, 2010 10:00
-
-
Save denisdefreyne/718780 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NEW: | |
def test_compile_with_two_mutually_dependent_reps | |
with_site(:compilation_rule_content => 'filter :erb') do |site| | |
File.open('content/foo.html', 'w') do |io| | |
io.write('<%= @items.find { |i| i.identifier == "/bar/" }.compiled_content %>') | |
end | |
File.open('content/bar.html', 'w') do |io| | |
io.write('<%= @items.find { |i| i.identifier == "/foo/" }.compiled_content %>') | |
end | |
assert_raises Nanoc3::Errors::RecursiveCompilation do | |
site.compile | |
end | |
end | |
end | |
# OLD: | |
def test_compile_reps_with_two_mutually_dependent_reps | |
# Mock reps | |
items = [ Nanoc3::Item.new("content1", {}, '/one/'), Nanoc3::Item.new("content2", {}, '/two/') ] | |
reps = [ Nanoc3::ItemRep.new(items[0], :moo), Nanoc3::ItemRep.new(items[1], :blah) ] | |
# Create compiler | |
compiler = Nanoc3::Compiler.new(nil) | |
compiler.instance_eval { @_reps = reps } | |
def compiler.compile_rep(rep) | |
if rep == @_reps[0] | |
raise Nanoc3::Errors::UnmetDependency.new(@_reps[1]) | |
elsif rep == @_reps[1] | |
raise Nanoc3::Errors::UnmetDependency.new(@_reps[0]) | |
else | |
raise RuntimeError, 'this shouldn not have happened' | |
end | |
end | |
# Compile | |
assert_raises Nanoc3::Errors::RecursiveCompilation do | |
compiler.send :compile_reps, reps | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment