Sha256: 44f236f82b9b7ef1ec1c757d138b23125a40b2f30cf817de2c37a0dbba030e9f
Contents?: true
Size: 987 Bytes
Versions: 21
Compression:
Stored size: 987 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
21 entries across 21 versions & 2 rubygems