Sha256: 4c909f3825a940450734ad5314a5e88339c5b3d4e33a2d254d9036beca695ea8

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require 'helper'

class TestSemanticAttributesHelper < TestCase

  context "semantic_attributes_helper" do

    setup do
      setup_fixtures
    end

    should "generate output event when no block given" do
      expected = html <<-EOHTML
        <div class="attrtastic user">
        </div>
      EOHTML
      actual = @template.semantic_attributes_for(@user)

      assert_equal expected, actual

      #@template.output_buffer.clear

      expected = html <<-EOHTML
        <div class="attrtastic blog">
        </div>
      EOHTML
      actual = @template.semantic_attributes_for(@blog)

      assert_equal expected, actual
    end

    should "run block" do
      block_run = false
      @template.semantic_attributes_for(@user) do |attr|
        block_run = true
      end

      assert block_run
    end

    should "accept options" do
      expected = html <<-EOHTML
        <div class="attrtastic user simple show">
        </div>
      EOHTML
      actual = @template.semantic_attributes_for(@user, :html => {:class => 'simple show'})

      assert_equal expected, actual
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
attrtastic-0.4.1 test/test_semantic_attributes_helper.rb
attrtastic-0.4.0 test/test_semantic_attributes_helper.rb
attrtastic-0.3.3 test/test_semantic_attributes_helper.rb
attrtastic-0.3.2 test/test_semantic_attributes_helper.rb
attrtastic-0.3.1 test/test_semantic_attributes_helper.rb
attrtastic-0.3.0 test/test_semantic_attributes_helper.rb