Sha256: ea7fe791657623812734a8740aa91d04077c320823c03da73a0cc3d958b1839b

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

#!/usr/bin/env ruby

require 'test/unit'
currentPath = File.dirname(__FILE__)
require File.join( currentPath, '../../lib/masterview' )
require File.join( currentPath, '../../lib/masterview/directives/omit_tag')

class TestOmit_tag < Test::Unit::TestCase
  include MasterView::Directives

  def setup
    @directives = MasterView::DirectiveSet.new
  end

  def test_omit_tag
    tag = MasterView::Tag.new(@directives, 'foo', { 'id' => 'foobar', 'style' => 'test'}, :normal, nil)
    @directives.directives = []
    attr_value = ""
    @directives << Omit_tag.new(attr_value)
    assert_equal nil, @directives.determine_dcs(:stag).render
    dcs = @directives.determine_dcs(:etag)
    dcs.context = tag.create_context
    dcs.context[:tag].content = "hello world"
    assert_equal nil, dcs.render
  end

  def test_omit_tag_eval
    tag = MasterView::Tag.new(@directives, 'foo', { 'id' => 'foobar', 'style' => 'test'}, :normal, nil)
    @directives.directives = []
    attr_value = "@test"
    @directives << Omit_tag.new(attr_value)
    assert_equal ["<% if @test %>", [], "<% end %>"], @directives.determine_dcs(:stag).render
    dcs = @directives.determine_dcs(:etag)
    dcs.context = tag.create_context
    dcs.context[:tag].content = "hello world"
    assert_equal ["<% if @test %>", [], "<% end %>"], dcs.render
  end


end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
masterview-0.2.0 test/unit/directive_omit_tag_test.rb
masterview-0.2.1 test/unit/directive_omit_tag_test.rb
masterview-0.2.2 test/unit/directive_omit_tag_test.rb
masterview-0.2.3 test/unit/directive_omit_tag_test.rb
masterview-0.2.4 test/unit/directive_omit_tag_test.rb
masterview-0.2.5 test/unit/directive_omit_tag_test.rb