Sha256: cc5f0af4aa667bdff614c33227ebe10db1a81912df56d770d5ef20ba33dc2403
Contents?: true
Size: 1.82 KB
Versions: 21
Compression:
Stored size: 1.82 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/link_to') class TestLinkTo < Test::Unit::TestCase include MasterView::Directives def setup @directives = MasterView::DirectiveSet.new end def test_default tag = MasterView::Tag.new(@directives, 'foo', {}, :normal, nil) @directives.directives = [] attr_value = ":action => 'show', :id => @product" @directives << Link_to.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 = "bar" assert_equal "<%= link_to 'bar', :action => 'show', :id => @product %>", dcs.render end def test_junk_name tag = MasterView::Tag.new(@directives, 'foo', {}, :normal, nil) @directives.directives = [] attr_value = "'dont use', :action => 'show', :id => @product" @directives << Link_to.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 = "bar" assert_equal "<%= link_to 'bar', :action => 'show', :id => @product %>", dcs.render end def test_junk_plus tag = MasterView::Tag.new(@directives, 'foo', {}, :normal, nil) @directives.directives = [] attr_value = "'dont use', 'nor this', :action => 'show', :id => @product" @directives << Link_to.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 = "bar" assert_equal "<%= link_to 'bar', :action => 'show', :id => @product %>", dcs.render end end
Version data entries
21 entries across 21 versions & 2 rubygems