show_for_tag is ignored on subsequent records when used with render :collection #46

Merged
merged 3 commits into from Jul 20, 2012

Conversation

Projects
None yet
3 participants
Contributor

blakehilscher commented Jul 19, 2012

Fix for show_for_tag being ignored on subsequent show_for calls during loop iteration and integration test

#45

@nashby nashby and 2 others commented on an outdated diff Jul 19, 2012

test/helper_test.rb
@@ -44,4 +44,11 @@ class HelperTest < ActionView::TestCase
assert_select "div.show_for.user.awesome"
end
end
+
+ test "show for tag should be configurable for each iteration" do
+ html_options = {:show_for_tag => :li}
+ concat( [@user, @user, @user].collect{ |user| show_for(user, html_options){|f|} }.join.html_safe )
+ assert_select "div.show_for.user", false
+ end
+
@nashby

nashby Jul 19, 2012

Collaborator

I think you can simplify this test as:

test "show for tag should be configurable for each iteration" do
  html_options = { :show_for_tag => :li }
  concat(show_for(@user, html_options) do |f| end)
  assert_equal({ :show_for_tag => :li }, html_options)
end
@blakehilscher

blakehilscher Jul 19, 2012

Contributor

Thanks for the input, i've revised the pull request with your suggestion.

@rafaelfranca

rafaelfranca Jul 19, 2012

Collaborator

And the test description better.

Something like this: doesn't modify the options hash

@blakehilscher

blakehilscher Jul 20, 2012

Contributor

Good suggestion - i've revised it to be more friendly.

@rafaelfranca rafaelfranca added a commit that referenced this pull request Jul 20, 2012

@rafaelfranca rafaelfranca Merge pull request #46 from blakehilscher/master
show_for_tag is ignored on subsequent records when used with render :collection
582449e

@rafaelfranca rafaelfranca merged commit 582449e into plataformatec:master Jul 20, 2012

Collaborator

rafaelfranca commented Jul 20, 2012

Merged! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment