Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
Fixing view helper so that it works without blocks. Handy for <% if(a…
Browse files Browse the repository at this point in the history
…b_test("show_some_element") %> ... <% end %>
  • Loading branch information
patio11 committed Aug 16, 2009
1 parent a120f95 commit a328f34
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/abingo_view_helper.rb
Expand Up @@ -22,8 +22,13 @@ def ab_test(test_name, alternatives = nil, options = {}, &block)
else
choice = Abingo.test(test_name, alternatives, options)
end
content_tag = capture(choice, &block)
block_called_from_erb?(block) ? concat(content_tag) : content_tag

if block
content_tag = capture(choice, &block)
block_called_from_erb?(block) ? concat(content_tag) : content_tag
else
choice
end
end

def bingo!(test_name, options = {})
Expand Down

0 comments on commit a328f34

Please sign in to comment.