Sha256: 7c0958272d7ec41784e07c4e60c36004e62839fb327ac761ad436e7277064b6a

Contents?: true

Size: 1.53 KB

Versions: 6

Compression:

Stored size: 1.53 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/block')

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

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

  def test_do
    @directives.directives = []
    attr_value = 'if true do'
    @directives << Block.new(attr_value)
    assert_equal "<% #{attr_value} %>", @directives.determine_dcs(:stag).render.join
    assert_equal "<% end %>", @directives.determine_dcs(:etag).render.join
  end

  def test_brack
    @directives.directives = []
    attr_value = 'if true {'
    @directives << Block.new(attr_value)
    assert_equal "<% #{attr_value} %>", @directives.determine_dcs(:stag).render.join
    assert_equal "<% } %>", @directives.determine_dcs(:etag).render.join
  end

  def test_brack2
    @directives.directives = []
    attr_value = 'if true { :foo => :bar } {'
    @directives << Block.new(attr_value)
    assert_equal "<% #{attr_value} %>", @directives.determine_dcs(:stag).render.join
    assert_equal "<% } %>", @directives.determine_dcs(:etag).render.join
  end

  def test_do2
    @directives.directives = []
    attr_value = 'if true { :foo => :bar } do'
    @directives << Block.new(attr_value)
    assert_equal 1, @directives.directives.size
    assert_equal "<% #{attr_value} %>", @directives.determine_dcs(:stag).render.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_block_test.rb
masterview-0.2.1 test/unit/directive_block_test.rb
masterview-0.2.2 test/unit/directive_block_test.rb
masterview-0.2.3 test/unit/directive_block_test.rb
masterview-0.2.4 test/unit/directive_block_test.rb
masterview-0.2.5 test/unit/directive_block_test.rb