require 'helper'
class TestAttrtastic < Test::Unit::TestCase
def setup
setup_fixtures
end
def test_attrtastic_verbose
expected = html <<-EOHTML
User
-
First name
John
-
Last name
Doe
Contact
-
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 "Contact" do
@template.output_buffer << (attr.attribute :email).to_s
end
end
actual = @template.output_buffer.to_s
assert_equal expected, actual
end
def test_attrtastic_compct
expected = html <<-EOHTML
User
-
First name
John
-
Last name
Doe
Contact
-
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