Sha256: c880162862b8a15cb4ae3c17b0ca0004c9be7ff7175e4c198d3d9e26839c2a74

Contents?: true

Size: 1.29 KB

Versions: 5

Compression:

Stored size: 1.29 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/replace')
require File.join( currentPath, '../directive_test_helper' )
DirectiveTestHelpers.load_masterview_directive('replace')

class TestReplace < Test::Unit::TestCase
  include DirectiveTestHelpers

  Replace = MasterView::Directives::Replace  # test subject

  ELEMENT_TAG = 'h1'
  TEMPLATE_ELEMENT_ATTRIBUTES = { 'id' => 'foobar', 'style' => 'test'}

  def check_element_rendering(expected_content)

    erbized_content = "<%= #{expected_content} %>"
    assert_equal '', render_element_event(:stag)
    #??what to do/check at :content processing point?
    assert_equal erbized_content, render_element_event(:etag)
 
    ###ISSUE: Needs work (?) - this should be verifying that the original tags are dropped

  end

  def test_replace

    # ensure we have some sample content that's getting replaced
    test_element = create_template_element ELEMENT_TAG, 
                      :attribute => TEMPLATE_ELEMENT_ATTRIBUTES,
                      :content => "product name goes here"

    attr_value = "h @product[name]"
    create_directive Replace, attr_value

    check_element_rendering attr_value

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masterview-0.3.2 test/unit/directive_replace_test.rb
masterview-0.3.0 test/unit/directive_replace_test.rb
masterview-0.3.1 test/unit/directive_replace_test.rb
masterview-0.3.3 test/unit/directive_replace_test.rb
masterview-0.3.4 test/unit/directive_replace_test.rb