Permalink
Browse files

Fixed the disappearing show-for wrapper bug introduced in the HAML fi…

…x - finally. Reverted the test helper changes to original.
  • Loading branch information...
1 parent e734c00 commit eff32cdd9263972bce47470c15a6ab9e7499f610 @grimen grimen committed Jan 9, 2010
Showing with 9 additions and 9 deletions.
  1. +1 −1 lib/show_for/helper.rb
  2. +8 −8 test/builder_test.rb
View
2 lib/show_for/helper.rb
@@ -15,7 +15,7 @@ def show_for(object, html_options={}, &block)
html_options[:id] ||= dom_id(object)
html_options[:class] = "show_for #{dom_class(object)} #{html_options[:class]}".strip
- content_tag(tag, yield(ShowFor::Builder.new(object, self)), html_options)
+ concat content_tag(tag, capture(ShowFor::Builder.new(object, self), &block), html_options)
end
end
end
View
16 test/builder_test.rb
@@ -3,27 +3,27 @@
class BuilderTest < ActionView::TestCase
def with_attribute_for(object, attribute, options={}, &block)
- concat(show_for(object) do |o|
+ show_for(object) do |o|
o.attribute(attribute, options, &block)
- end)
+ end
end
def with_association_for(object, association, options={}, &block)
- concat(show_for(object) do |o|
+ show_for(object) do |o|
o.association(association, options, &block)
- end)
+ end
end
def with_label_for(object, attribute, options={})
- concat(show_for(object) do |o|
+ show_for(object) do |o|
o.label attribute, options
- end)
+ end
end
def with_content_for(object, value, options={})
- concat(show_for(object) do |o|
+ show_for(object) do |o|
o.content value, options
- end)
+ end
end
# WRAPPER

0 comments on commit eff32cd

Please sign in to comment.