Sha256: 52520c41d9652fa39199b1b19dd2273a1ba38894fdd82362a819b979d4154a2a

Contents?: true

Size: 973 Bytes

Versions: 6

Compression:

Stored size: 973 Bytes

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/else')

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

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

  def test_else
    parent_tag = MasterView::Tag.new(@directives, 'div', {}, :normal, nil)
    parent_tag.content = ['<% if true %>hello world', '<% end %>']

    else_tag = MasterView::Tag.new(@directives, 'bar', {}, :normal, parent_tag)
    @directives.directives = []
    attr_value = 'not used'
    @directives << Else.new(attr_value)
    dcs = @directives.determine_dcs(:stag)
    dcs.context = else_tag.create_context

    assert_equal "<% else %>", dcs.render.join
    assert_equal "<% if true %>hello world", parent_tag.content.join
    assert_equal "<% end %>", @directives.determine_dcs(:etag).render.join
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

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