・テストで、@valid_dataを使っても、mergeする際にシンボルが使える
parameters =
assigns(:informal_decision).attributes.symbolize_keys.merge(options)
def test_update_profile_success_ident simurate_informal_decision_login_2 @request.user_agent = "DoCoMo/2.0 D902i(c100;TB;W23H16;ser999999999999999;icc00000000000000000000)" post :update_profile, :informal_decision => { :name => "ざき".tosjis, :name_view_status => 1, :school => "ざき大学".tosjis, :faculty => "ざき部".tosjis, informal_decision_company => "有限会社ざき".tosjis, :hope_occupational_category => "ざき営業".tosjis, :hope_prefecture => "ざき州".tosjis, :graduation_schedule => Time.now.year, profile => "ざきです。呪文のザキではありません。".tosjis }, :user => {:name_searchable_status => User::YES} assert_redirected_to :action => "result_update_profile" assert_equal InformalDecision.find_by_user_id(10).name,"ざき" assert_equal InformalDecision.find_by_user_id(10).school,"ざき大学" assert_equal InformalDecision.find_by_user_id(10).faculty, "ざき部" assert_equal InformalDecision.find_by_user_id(10).informal_decision_company, "有限会社ざき" assert_equal InformalDecision.find_by_user_id(10).hope_occupational_category, "ざき営業" assert_equal InformalDecision.find_by_user_id(10).hope_prefecture, "ざき州" assert_equal InformalDecision.find_by_user_id(10).profile, "ざきです。呪文のザキではありません。" assert_equal User::YES, @user.reload.name_searchable_status end def update_profile(options = {}) test_edit_confirmation parameters = assigns(:informal_decision).attributes.symbolize_keys.merge(options) post :update_profile, :informal_decision => parameters, :user => {:name_searchable_status => User::YES} end