Sha256: 0abd4d4d118260233e695b8478dc186af61a457424443756680b75a32fd254be

Contents?: true

Size: 840 Bytes

Versions: 6

Compression:

Stored size: 840 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/replace')

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

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

  def test_replace
    tag = MasterView::Tag.new(@directives, 'foo', { 'id' => 'foobar', 'style' => 'test'}, :normal, nil)
    @directives.directives = []
    attr_value = "h @product[name]"
    @directives << Replace.new(attr_value)
    assert_equal nil, @directives.determine_dcs(:stag).render
    dcs = @directives.determine_dcs(:etag)
    dcs.context = tag.create_context
    dcs.context[:tag].content = "hello world"
    assert_equal "<%= h @product[name] %>", dcs.render
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

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