Sha256: db95a4e5bf177399ebe466c3376725ae6c2631e38b500b5f3c0d0e12aa755b3f
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. require 'spec/helper' spec_require 'ramaze/template/haml' class TCTemplateHamlController < Ramaze::Controller map :/ template_root __DIR__/:haml engine :Haml helper :link def index end def with_vars @title = "Teen Wolf" end end class TCRamazeLocals < Ramaze::Controller map '/test' template_root __DIR__/:haml helper :partial def render_with_locals render_template 'locals.haml', :abc => 'def' end end class TCTemplateHamlLocalsController < Ramaze::Controller map '/locals' engine :Haml trait :haml_options => { :locals => { :localvar => 'abcdefg' } } def test %{= localvar} end end describe "Haml templates" do behaves_like 'http' ramaze(:compile => true) it "should render" do get('/').body.strip.should == %{<div id='contact'> <h1>Eugene Mumbai</h1> <ul class='info'> <li class='login'>eugene</li> <li class='email'>eugene@example.com</li> </ul> </div>} end it "should have access to variables defined in controller" do get('/with_vars').body.strip.should == %{<div id='content'> <div class='title'> <h1>Teen Wolf</h1> <a href="/Home">Home</a> </div> </div>} end it 'should support locals via render_template' do get('/test/render_with_locals').body.strip.should == 'def' end it "should have access to locals defined" do get('/locals/test').body.strip.should == 'abcdefg' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ramaze-0.3.5 | spec/ramaze/template/haml.rb |