Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add spec for case when we pass a block with argument to attribute

closes #48
  • Loading branch information...
commit 1e0e228f744addc93541314bf9bb3a32ae7b72fa 1 parent 9b1ebb0
@nashby nashby authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 test/attribute_test.rb
View
11 test/attribute_test.rb
@@ -133,6 +133,13 @@ class AttributeTest < ActionView::TestCase
assert_select "div.show_for p.wrapper", /This description/
end
+ test "show_for#content given a block should be wrapped in the result" do
+ with_attribute_for @user, :name do |name|
+ "<div class='block'>#{name}</div>".html_safe
+ end
+ assert_select "p.wrapper.user_name div.block", /ShowFor/
+ end
+
test "show_for escapes content by default" do
@user.name = "<b>hack you!</b>"
with_attribute_for @user, :name
@@ -171,7 +178,7 @@ class AttributeTest < ActionView::TestCase
assert_select "div.show_for p.user_email.wrapper", /Not specified/
assert_select "p.user_email strong.label", "Email"
end
-
+
test "show_for should wrap blank attributes with no_attribute" do
swap ShowFor, :blank_content_class => 'no_attribute' do
with_attributes_for @user, :name, :birthday
@@ -179,5 +186,5 @@ class AttributeTest < ActionView::TestCase
assert_select ".wrapper.user_name.no_attribute", false
end
end
-
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.