Sha256: 21c99716a5db81bb04f2a928442060b5869946de8019401e41e175eb03cbf58b
Contents?: true
Size: 1.78 KB
Versions: 11
Compression:
Stored size: 1.78 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/attr') class TestAttr < Test::Unit::TestCase include MasterView::Directives def setup @directives = MasterView::DirectiveSet.new @tag = MasterView::Tag.new(@directives, 'foo', {'bar' => 'cat'}, :normal, nil) end def test_hello @directives.directives = [] attr_value = "{:hello => 'world'}" @directives << Attr.new(attr_value) dcs = @directives.determine_dcs(:stag) dcs.context = @tag.create_context assert_equal '', dcs.render.join assert_equal 'cat', dcs.context[:tag].attributes['bar'] assert_equal 'world', dcs.context[:tag].attributes['hello'] end def test_hello_hi @directives.directives = [] attr_value = ":hello => 'world', :hi => 'there'" @directives << Attr.new(attr_value) dcs = @directives.determine_dcs(:stag) dcs.context = @tag.create_context assert_equal '', dcs.render.join assert_equal 'cat', dcs.context[:tag].attributes['bar'] assert_equal 'world', dcs.context[:tag].attributes['hello'] assert_equal 'there', dcs.context[:tag].attributes['hi'] end def test_hello_erb @directives.directives = [] attr_value = %q":hello => 'world', :hi => 'there', :wow => #{h product.name}" @directives << Attr.new(attr_value) dcs = @directives.determine_dcs(:stag) dcs.context = @tag.create_context assert_equal '', dcs.render.join assert_equal 'cat', dcs.context[:tag].attributes['bar'] assert_equal 'world', dcs.context[:tag].attributes['hello'] assert_equal 'there', dcs.context[:tag].attributes['hi'] assert_equal '{{{= h product.name }}}', dcs.context[:tag].attributes['wow'] end end
Version data entries
11 entries across 11 versions & 1 rubygems