Sha256: d1e3326052b5613eb699104ac7af27f489030e593f343a7b22cfd0cc2fa9fda1

Contents?: true

Size: 1.17 KB

Versions: 21

Compression:

Stored size: 1.17 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/global_inline_erb')

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

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

  def test_hello
    @tag = MasterView::Tag.new(@directives, 'foo', {'hello' => 'foo bar {{{=hello world}}}', 'world' => '{{{fine}}}'}, :normal, nil)
    @directives.directives = []
    @directives << Global_inline_erb.new
    @directives << MasterView::SimpleRenderHandler.new
    dcs = @directives.determine_dcs(:stag)
    dcs.context = @tag.create_context
    assert_equal '<foo hello="foo bar <%=hello world%>" world="<%fine%>">', dcs.render.join
    #assert_equal "<%= #{attr_value} %>", dcs.context[:tag].content

    dcs = @directives.determine_dcs(:characters)
    dcs.context = @tag.create_context(:content_part => 'more text here {{{= foo(bar) }}} more then {{{exec {:hello => :world} }}} finally')
    assert_equal 'more text here <%= foo(bar) %> more then <%exec {:hello => :world} %> finally', dcs.render.join
  end

end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
masterview_parser-0.0.6 test/global_inline_erb_test.rb