学習ログ Hamlをちょろっと触った

http://haml.ursm.jp/
を参考にw

require File.dirname(__FILE__) + '/../../spec_helper'

describe "/hello/index.html.haml" do
  before(:each) do
    render    
  end
  
  it "renders '%title Hello, Haml!'" do
    response.should include_text "<title>Hello, Haml!</title>"
  end

  it "renders '%tagname{ :attr1 => 'value1', :attr2 => 'value2' } Contents'" do
    response.should include_text "<tagname attr1='value1' attr2='value2'>Contents</tagname>"
  end

  it "renders '#foo Hello!'" do
    response.should include_text "<div id='foo'>Hello!</div>"
  end

  ul_should =<<-HAML
  %ul
    %li Salt
    %li Pepper  
  HAML
  it "renders '#{ul_should}'" do
    response.should include_text <<-HTML
    <ul>
      <li>Salt</li>
      <li>Pepper</li>
    </ul>
    HTML
  end
  
  p_should =<<-HAML
  %p
    Hello,
    World!
  HAML
  it "renders '#{p_should}'" do
    response.should include_text <<-HTML
    <p>
      Hello,
      World!
    </p>
    HTML
  end
end