test/unit/directive_if_test.rb in masterview-0.2.5 vs test/unit/directive_if_test.rb in masterview-0.3.0
- old
+ new
@@ -1,23 +1,26 @@
#!/usr/bin/env ruby
require 'test/unit'
currentPath = File.dirname(__FILE__)
require File.join( currentPath, '../../lib/masterview' )
-require File.join( currentPath, '../../lib/masterview/directives/if')
+#require File.join( currentPath, '../../lib/masterview/directives/if')
+require File.join( currentPath, '../directive_test_helper' )
+DirectiveTestHelpers.load_masterview_directive('if')
class TestIf < Test::Unit::TestCase
- include MasterView::Directives
+ include DirectiveTestHelpers
+ If = MasterView::Directives::If # test subject
+
def setup
- @directives = MasterView::DirectiveSet.new
+ create_template_element
end
def test_if
- @directives.directives = []
attr_value = 'true'
- @directives << If.new(attr_value)
- assert_equal "<% if #{attr_value} %>", @directives.determine_dcs(:stag).render.join
- assert_equal "<% end %>", @directives.determine_dcs(:etag).render.join
+ create_directive If, attr_value
+ assert_equal "<% if( #{attr_value} ) -%>", render_element_event(:stag)
+ assert_equal "<% end -%>", render_element_event(:etag)
end
end