Sha256: e7b96e05f9dfe7bfe19baee382f4dbf6f78e75180d45b84f088e8f45776c023e

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 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

6 entries across 6 versions & 1 rubygems

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