aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/record_tag_helper_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-06-19 22:03:27 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-19 22:21:56 -0700
commit72f93b581f1d1a7496ccebbd90578714c171c5a5 (patch)
tree0e89550d0297bba6a87c8eae507c7388d62c92e8 /actionpack/test/template/record_tag_helper_test.rb
parentc440c9b199d7474e356472616ef03f9c7e17c405 (diff)
downloadrails-72f93b581f1d1a7496ccebbd90578714c171c5a5.tar.gz
rails-72f93b581f1d1a7496ccebbd90578714c171c5a5.tar.bz2
rails-72f93b581f1d1a7496ccebbd90578714c171c5a5.zip
Check whether blocks are called from erb using a special __in_erb_template variable visible in block binding.
Diffstat (limited to 'actionpack/test/template/record_tag_helper_test.rb')
-rw-r--r--actionpack/test/template/record_tag_helper_test.rb27
1 files changed, 14 insertions, 13 deletions
diff --git a/actionpack/test/template/record_tag_helper_test.rb b/actionpack/test/template/record_tag_helper_test.rb
index 441dc6b720..34a200b933 100644
--- a/actionpack/test/template/record_tag_helper_test.rb
+++ b/actionpack/test/template/record_tag_helper_test.rb
@@ -2,7 +2,7 @@ require 'abstract_unit'
class Post
def id
- 45
+ 45
end
def body
"What a wonderful world!"
@@ -15,35 +15,36 @@ class RecordTagHelperTest < ActionView::TestCase
def setup
@post = Post.new
end
-
+
def test_content_tag_for
expected = %(<li class="post bar" id="post_45"></li>)
actual = content_tag_for(:li, @post, :class => 'bar') { }
assert_dom_equal expected, actual
end
-
+
def test_content_tag_for_prefix
expected = %(<ul class="post" id="archived_post_45"></ul>)
actual = content_tag_for(:ul, @post, :archived) { }
- assert_dom_equal expected, actual
+ assert_dom_equal expected, actual
end
-
+
def test_content_tag_for_with_extra_html_tags
expected = %(<tr class="post bar" id="post_45" style='background-color: #f0f0f0'></tr>)
actual = content_tag_for(:tr, @post, {:class => "bar", :style => "background-color: #f0f0f0"}) { }
- assert_dom_equal expected, actual
+ assert_dom_equal expected, actual
end
-
- def test_block_works_with_content_tag_for
+
+ def test_block_works_with_content_tag_for_in_erb
+ __in_erb_template = ''
expected = %(<tr class="post" id="post_45">#{@post.body}</tr>)
actual = content_tag_for(:tr, @post) { concat @post.body }
- assert_dom_equal expected, actual
+ assert_dom_equal expected, actual
end
-
- def test_div_for
+
+ def test_div_for_in_erb
+ __in_erb_template = ''
expected = %(<div class="post bar" id="post_45">#{@post.body}</div>)
actual = div_for(@post, :class => "bar") { concat @post.body }
assert_dom_equal expected, actual
- end
-
+ end
end