require 'helper' class TestAttrtastic < Test::Unit::TestCase context "Attrtastic" do setup do setup_fixtures end should "work with verbose syntax version" do expected = html <<-EOHTML
User
  1. First name John
  2. Last name Doe
Contact
  1. Email john@doe.com
EOHTML @template.semantic_attributes_for(@user) do |attr| attr.attributes "User" do @template.output_buffer << (attr.attribute :first_name, :html => {:class => :strong}).to_s @template.output_buffer << (attr.attribute :last_name).to_s @template.output_buffer << (attr.attribute :title).to_s end attr.attributes :name => "Contact" do @template.output_buffer << (attr.attribute :email).to_s end end actual = @template.output_buffer.to_s assert_equal expected, actual end should "work with compact syntax version" do expected = html <<-EOHTML
User
  1. First name John
  2. Last name Doe
Contact
  1. Email john@doe.com
EOHTML @template.semantic_attributes_for(@user) do |attr| attr.attributes "User", :first_name, :last_name, :title attr.attributes "Contact", :email end end end end