From eeafd08ca50242b0c0a61acc5770dd1edfc8951a Mon Sep 17 00:00:00 2001 From: Daniel Bucher Date: Thu, 5 Jun 2014 19:06:27 -0300 Subject: [PATCH] profile_editor: added mass-assign support for community fields --- app/models/community.rb | 2 +- test/functional/profile_editor_controller_test.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/community.rb b/app/models/community.rb index 0e198b9..e36ddf0 100644 --- a/app/models/community.rb +++ b/app/models/community.rb @@ -1,6 +1,6 @@ class Community < Organization - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type + attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type, :address_reference, :district, :tag_list, :language after_destroy :check_invite_member_for_destroy def self.type_name diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index 55509bf..b8d8277 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -173,6 +173,15 @@ class ProfileEditorControllerTest < ActionController::TestCase assert_tag :tag => 'input', :attributes => { :name => 'profile_data[contact_person]', :value => 'my contact' } end + should 'mass assign all environment configurable community fields' do + cmm = fast_create(Community) + + post :edit, :profile => cmm.identifier, :profile_data => { "name" => "new name", "display_name" => "N&w N@me", "description"=>"We sell food and other stuff.", "contact_person"=>"Joseph of the Jungle", "contact_email"=>"sac@company.net", "contact_phone"=>"+0551133445566", "legal_form"=>"New Name corp.", "economic_activity"=>"Food", "management_information"=>"No need for that here.", "address"=>"123, baufas street", "address_reference"=>"Next to baufas house", "district"=>"DC", "zip_code"=>"123456", "city"=>"Whashington", "state"=>"DC", "country"=>"US", "tag_list"=>"food, corporations", "language"=>"English" } + + assert_response :redirect + assert_redirected_to :controller => 'profile_editor', :action => 'index' + end + should 'show field values on edit enterprise info' do Enterprise.any_instance.expects(:active_fields).returns(['contact_person']).at_least_once org = fast_create(Enterprise) -- libgit2 0.21.2