Skip to content
Browse files

Merge pull request #54 from nashby/spec-for-issue-48

add spec for case when we pass a block with argument to attribute
  • Loading branch information...
2 parents 9b1ebb0 + 1e0e228 commit 6f3a16ececf6c23948f7264fb04e940550a92551 @carlosantoniodasilva carlosantoniodasilva committed Oct 16, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 test/attribute_test.rb
11 test/attribute_test.rb
@@ -133,6 +133,13 @@ class AttributeTest < ActionView::TestCase
assert_select "div.show_for p.wrapper", /This description/
+ 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 = "<b>hack you!</b>"
with_attribute_for @user, :name
@@ -171,13 +178,13 @@ class AttributeTest < ActionView::TestCase
assert_select "div.show_for p.user_email.wrapper", /Not specified/
assert_select "p.user_email strong.label", "Email"
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
assert_select ".wrapper.user_birthday.no_attribute"
assert_select ".wrapper.user_name.no_attribute", false

0 comments on commit 6f3a16e

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