diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-08-01 19:32:22 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-08-01 19:32:22 -0300 |
commit | fb0bd8c1092db51888ec4bb72af6c595e13c31fa (patch) | |
tree | 22b264d2259043b1d4b922527cb2b611c3baf67a /actionpack/test/template | |
parent | f78de6864998369002a5b1906dad151b6c787c24 (diff) | |
download | rails-fb0bd8c1092db51888ec4bb72af6c595e13c31fa.tar.gz rails-fb0bd8c1092db51888ec4bb72af6c595e13c31fa.tar.bz2 rails-fb0bd8c1092db51888ec4bb72af6c595e13c31fa.zip |
Makes form_helper use overriden model accessors
[#3374 state:committed]
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 9ddfa13c16..f248a38ae9 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -4,6 +4,16 @@ require 'controller/fake_models' class FormHelperTest < ActionView::TestCase tests ActionView::Helpers::FormHelper + class Developer + def name_before_type_cast + "David" + end + + def name + "Santiago" + end + end + def form_for(*) @output_buffer = super end @@ -233,6 +243,13 @@ class FormHelperTest < ActionView::TestCase text_field("user", "email", :type => "email") end + def test_text_field_from_a_user_defined_method + @developer = Developer.new + assert_dom_equal( + '<input id="developer_name" name="developer[name]" size="30" type="text" value="Santiago" />', text_field("developer", "name") + ) + end + def test_check_box assert_dom_equal( '<input name="post[secret]" type="hidden" value="0" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" />', |