require File.dirname(__FILE__) + '/helper' context "Erb" do setup do Sinatra.application = nil end context "without layouts" do setup do Sinatra.application = nil end specify "should render" do get '/no_layout' do erb '<%= 1 + 1 %>' end get_it '/no_layout' should.be.ok body.should == '2' end specify "should take an options hash with :locals set with a string" do get '/locals' do erb '<%= foo %>', :locals => {:foo => "Bar"} end get_it '/locals' should.be.ok body.should == 'Bar' end specify "should take an options hash with :locals set with a complex object" do get '/locals-complex' do erb '<%= foo[0] %>', :locals => {:foo => ["foo", "bar", "baz"]} end get_it '/locals-complex' should.be.ok body.should == 'foo' end end context "with layouts" do setup do Sinatra.application = nil end specify "can be inline" do layout do %Q{This is <%= yield %>!} end get '/lay' do erb 'Blake' end get_it '/lay' should.be.ok body.should.equal 'This is Blake!' end specify "can use named layouts" do layout :pretty do %Q{