Sha256: 50fc1919ee82e4cc6122f91271a909ddcef7b79d963c3e491a6af97b67d7752e

Contents?: true

Size: 988 Bytes

Versions: 6

Compression:

Stored size: 988 Bytes

Contents

require 'assert'
require 'deas-erbtags/tag'

module Deas::ErbTags::Tag

  class BaseTests < Assert::Context
    desc "the basic tag method"
    setup do
      @opts = { :class => 'big', :id => '1234' }
      @opts_attrs = Factory.html_attrs(@opts)
      @content = "Loud Noises"
      @template = Factory.template(Deas::ErbTags::Tag)
    end
    subject{ @template }

    should have_imeth :tag

    should "create an empty html tag" do
      assert_equal "<br />", @template.tag(:br)
    end

    should "create an html tag with attributes" do
      assert_equal "<br#{@opts_attrs} />", @template.tag(:br, @opts)
    end

    should "create an html tag with content" do
      exp_markup = "<h1>#{@content}</h1>"
      assert_equal exp_markup, @template.tag(:h1, @content)
    end

    should "create an html tag with attributes and content" do
      exp_markup = "<h1#{@opts_attrs}>#{@content}</h1>"
      assert_equal exp_markup, @template.tag(:h1, @content, @opts)
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
deas-erbtags-0.5.0 test/unit/tag_tests.rb
deas-erbtags-0.4.2 test/unit/tag_tests.rb
deas-erbtags-0.4.1 test/unit/tag_tests.rb
deas-erbtags-0.4.0 test/unit/tag_tests.rb
deas-erbtags-0.3.0 test/unit/tag_tests.rb
deas-erbtags-0.2.0 test/unit/tag_tests.rb