[MacRuby-devel] Having trouble with block yielding in the Tilt gem

Nick Ludlam nick at recoil.org
Sun Feb 27 16:13:20 PST 2011


Hi all,
Am eagerly getting on with my app, and I'm embedding a little Sinatra app with the aid of ControlTower. So far so good, except with template rendering.

I cannot seem to get a "layout.erb" file to play nicely with an "index.erb" file, and have the layout successfully yield to a block given by the index template. This seems to bear up with testing the unit tests in the Tilt gem. Apart from nearly every test failing, the particular test for blocks yielding correctly is:

 16) Error:
test_passing_a_block_for_yield(ERBTemplateTest):
LocalJumpError: no block given
    /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/tilt-1.2.2/test/(__TEMPLATE__):1:in `<main>'
    /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/tilt-1.2.2/lib/tilt.rb:251:in `evaluate_source:'
    /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/tilt-1.2.2/lib/tilt.rb:186:in `cached_evaluate:'
    /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/tilt-1.2.2/lib/tilt.rb:169:in `evaluate:'
    /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/tilt-1.2.2/lib/tilt.rb:118:in `render'
    /Library/Frameworks/MacRuby.framework/Versions/0.10/usr/lib/ruby/Gems/1.9.2/gems/tilt-1.2.2/test/tilt_erbtemplate_test.rb:58:in `block'

And the code for the test is:

  test "passing a block for yield" do
    template = Tilt::ERBTemplate.new { 'Hey <%= yield %>!' }
    assert_equal "Hey Joe!", template.render { 'Joe' }
  end


I can try to reduce this test case down to something manageable, but I wanted to have a quick check with the the wisdom of the list as to what might cause this.


Thanks,
Nick



More information about the MacRuby-devel mailing list