example/config.ru in happy-0.1.0.pre25 vs example/config.ru in happy-0.1.0.pre27

- old
+ new

@@ -5,10 +5,12 @@ require 'happy' require 'happy/extras/action_controller' require 'happy/extras/resource_controller' +require 'haml' + # Controllers are the core building blocks of Happy applications. # They're also just Rack apps, so in any Happy app, you will # declare at least a "root" controller class and run that through Rack. class TestApp < Happy::Controller @@ -22,10 +24,12 @@ # Usually, you'd use the #path method to specify code to be executed if # a certain path was requested; in this app, we're using a custom #example # method, that does the same thing but also records the example in a hash # so we can generated a "table of contents" in index.erb. + set :views, File.expand_path("#{File.dirname(__FILE__)}/views") + def route example 'Returning just a string' do "I'm just a string!" end @@ -118,10 +122,19 @@ example 'ResourceController' do run ResourceTest end + example "Block Helpers" do + on('erb') { render 'block_helpers.erb' } + on('haml') { render 'block_helpers.haml' } + end + render 'index.erb' + end + + def blockquotify(&blk) + concat_output html_tag(:blockquote) { capture_template_block(&blk) } end def examples; @examples ||= {}; end def example(name, path_name = nil, &blk)