Sha256: efdb69c7ccbfbffabd9ad327e6edc83b8aa168d7f0d9d6a362e5267a0cb2d84f

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'helper'

class TestSemanticAttributesHelper < Test::Unit::TestCase

  def setup
    setup_fixtures
  end

  def test__semantic_attributes_for__output_with_no_block
    expected = html <<-EOHTML
      <div class="attrtastic user">
      </div>
    EOHTML

    @template.semantic_attributes_for(@user)
    actual = @template.output_buffer.to_s
    assert_equal expected, actual

    @template.output_buffer.clear

    expected = html <<-EOHTML
      <div class="attrtastic blog">
      </div>
    EOHTML

    @template.semantic_attributes_for(@blog)
    actual = @template.output_buffer.to_s
    assert_equal expected, actual
  end

  def test__semantic_attributes_for__should_run_block
    block_run = false
    @template.semantic_attributes_for(@user) do |attr|
      block_run = true
    end

    assert block_run
  end

  def test__semantic_attributes_for__with_options
    expected = html <<-EOHTML
      <div class="attrtastic user simple show">
      </div>
    EOHTML

    @template.semantic_attributes_for(@user, :html => {:class => 'simple show'})
    actual = @template.output_buffer.to_s
    assert_equal expected, actual
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
attrtastic-0.1.3 test/test_semantic_attributes_helper.rb
attrtastic-0.1.2 test/test_semantic_attributes_helper.rb