Sha256: c0c6d121585dd842f3ec9ff8107cd242c16b0b6f0c206801eeddf9d76ddcebfd
Contents?: true
Size: 993 Bytes
Versions: 6
Compression:
Stored size: 993 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/elsif') class TestElsif < Test::Unit::TestCase include MasterView::Directives def setup @directives = MasterView::DirectiveSet.new end def test_elsif parent_tag = MasterView::Tag.new(@directives, 'div', {}, :normal, nil) parent_tag.content = ['<% if true %>hello world', '<% end %>'] elsif_tag = MasterView::Tag.new(@directives, 'bar', {}, :normal, parent_tag) @directives.directives = [] attr_value = '@foobar' @directives << Elsif.new(attr_value) dcs = @directives.determine_dcs(:stag) dcs.context = elsif_tag.create_context assert_equal "<% elsif #{attr_value} %>", dcs.render.join assert_equal "<% if true %>hello world", parent_tag.content.join assert_equal "<% end %>", @directives.determine_dcs(:etag).render.join end end
Version data entries
6 entries across 6 versions & 1 rubygems