aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-02-01 16:14:24 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-02-02 09:40:24 -0200
commit17d214a1d4c71db39d2a4cab4d18ccea9f5b8ab5 (patch)
tree77eb411483d90accbc1f3b009a4d0a48a706bdf5 /actionpack/test
parentc988aaf69086af78dcb6eebf357e1149fc45e2ac (diff)
downloadrails-17d214a1d4c71db39d2a4cab4d18ccea9f5b8ab5.tar.gz
rails-17d214a1d4c71db39d2a4cab4d18ccea9f5b8ab5.tar.bz2
rails-17d214a1d4c71db39d2a4cab4d18ccea9f5b8ab5.zip
Create a Builder factory class to use with collection helpers + block
This will make it easy for the user to handle how check box/radio and labels should be generated, abstracting any text/value/default html options required to make it work. [Carlos Antonio da Silva + Rafael Mendonça França]
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/form_collections_helper_test.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/test/template/form_collections_helper_test.rb b/actionpack/test/template/form_collections_helper_test.rb
index ac8e7ddb3f..926be24044 100644
--- a/actionpack/test/template/form_collections_helper_test.rb
+++ b/actionpack/test/template/form_collections_helper_test.rb
@@ -84,8 +84,8 @@ class FormCollectionsHelperTest < ActionView::TestCase
end
test 'collection radio accepts a block to render the radio and label as required' do
- with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |label_for, text, value, html_options|
- label(:user, label_for, text) { radio_button(:user, :active, value, html_options) }
+ with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b|
+ b.label { b.radio_button }
end
assert_select 'label[for=user_active_true] > input#user_active_true[type=radio]'
@@ -229,8 +229,8 @@ class FormCollectionsHelperTest < ActionView::TestCase
end
test 'collection check boxes accepts a block to render the radio and label as required' do
- with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |label_for, text, value, html_options|
- label(:user, label_for, text) { check_box(:user, :active, html_options, value) }
+ with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b|
+ b.label { b.check_box }
end
assert_select 'label[for=user_active_true] > input#user_active_true[type=checkbox]'