Commit eeafd08ca50242b0c0a61acc5770dd1edfc8951a

Authored by Daniel
1 parent 768db9b2

profile_editor: added mass-assign support for community fields

Added mass-assign support for all community's field that are configurable on
the fields environment page.

(ActionItem3147)
app/models/community.rb
1 1 class Community < Organization
2 2  
3   - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type
  3 + attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type, :address_reference, :district, :tag_list, :language
4 4 after_destroy :check_invite_member_for_destroy
5 5  
6 6 def self.type_name
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -173,6 +173,15 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
173 173 assert_tag :tag => 'input', :attributes => { :name => 'profile_data[contact_person]', :value => 'my contact' }
174 174 end
175 175  
  176 + should 'mass assign all environment configurable community fields' do
  177 + cmm = fast_create(Community)
  178 +
  179 + 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" }
  180 +
  181 + assert_response :redirect
  182 + assert_redirected_to :controller => 'profile_editor', :action => 'index'
  183 + end
  184 +
176 185 should 'show field values on edit enterprise info' do
177 186 Enterprise.any_instance.expects(:active_fields).returns(['contact_person']).at_least_once
178 187 org = fast_create(Enterprise)
... ...