Skip to content
Browse files

adding tests

  • Loading branch information...
1 parent c095954 commit ea3132310044315bf5adb0c479a9241fa50845fc Ben VandenBos committed Sep 24, 2008
Showing with 41 additions and 0 deletions.
  1. +41 −0 test/render_partial_comments_test.rb
View
41 test/render_partial_comments_test.rb
@@ -0,0 +1,41 @@
+require 'test/unit'
+
+# first defined some stubs...
+module ActionView; end;
+
+class ActionView::Base
+
+ def render_partial_wrapper(partial_path)
+ render_partial(partial_path)
+ end
+
+ private
+
+ def render_partial(partial_path, object_assigns = nil, local_assigns = {})
+ "<b>Some junk html</b>"
+ end
+
+end
+
+
+require File.join(File.dirname(__FILE__), '../lib', 'render_partial_comments')
+
+class RenderPartialCommentsTest < Test::Unit::TestCase
+
+ def test_disabled
+ a = ActionView::Base.new
+ $render_partial_comments = false
+
+ r = a.render_partial_wrapper('user/view')
+ assert_equal("<b>Some junk html</b>", r)
+ end
+
+ def test_enabled
+ a = ActionView::Base.new
+ $render_partial_comments = true
+
+ r = a.render_partial_wrapper('user/view')
+ assert_equal("<!-- render_begin 'user/view' --><b>Some junk html</b><!-- render_end 'user/view' -->", r)
+ end
+
+end

0 comments on commit ea31323

Please sign in to comment.
Something went wrong with that request. Please try again.