Sha256: 455e2353e633e31e4cd22a7449fb3cb0b1c013908ff7993dcff32bf2bc8b6889

Contents?: true

Size: 1.53 KB

Versions: 21

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

21 entries across 21 versions & 2 rubygems

Version Path
masterview-0.0.10 test/block_test.rb
masterview-0.0.11 test/block_test.rb
masterview-0.0.12 test/block_test.rb
masterview-0.0.13 test/block_test.rb
masterview-0.0.14 test/block_test.rb
masterview-0.0.15 test/block_test.rb
masterview-0.0.16 test/block_test.rb
masterview-0.0.17 test/block_test.rb
masterview-0.0.2 test/block_test.rb
masterview-0.1.1 test/block_test.rb
masterview-0.1.2 test/block_test.rb
masterview-0.1.3 test/block_test.rb
masterview-0.1.5 test/block_test.rb
masterview-0.0.7 test/block_test.rb
masterview-0.0.8 test/block_test.rb
masterview-0.0.9 test/block_test.rb
masterview-0.1.0 test/block_test.rb
masterview_parser-0.0.3 test/block_test.rb
masterview_parser-0.0.4 test/block_test.rb
masterview_parser-0.0.5 test/block_test.rb