Commit 0d740187fabb723c32f2ddd83b7b950e84bc6861

Authored by Daniel
1 parent eeafd08c

profile_editor: added mass-assign support for enterprise fields

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

(ActionItem3147)
app/models/enterprise.rb
... ... @@ -2,6 +2,8 @@
2 2 # only enterprises can offer products and services.
3 3 class Enterprise < Organization
4 4  
  5 + attr_accessible :business_name, :address_reference, :district, :tag_list, :organization_website, :historic_and_current_context, :activities_short_description, :products_per_catalog_page
  6 +
5 7 SEARCH_DISPLAYS += %w[map full]
6 8  
7 9 def self.type_name
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -191,6 +191,15 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
191 191 assert_tag :tag => 'input', :attributes => { :name => 'profile_data[contact_person]', :value => 'my contact' }
192 192 end
193 193  
  194 + should 'mass assign all environment configurable enterprise fields' do
  195 + enterprise = fast_create(Enterprise)
  196 +
  197 + post :edit, :profile => enterprise.identifier, :profile_data => { "name"=>"Enterprise", "display_name"=>"Enterprise name", "business_name"=>"Enterprise", "description"=>"Hello IT.", "contact_person"=>"Joseph", "contact_email"=>"joe@enterprise.net", "contact_phone"=>"+0551133445566", "legal_form"=>"Enterprise corp.", "economic_activity"=>"Food", "management_information"=>"None.", "address"=>"123, baufas street", "address_reference"=>"Next to baufas house", "district"=>"DC", "zip_code"=>"123456", "city"=>"Washington", "state"=>"DC", "country"=>"US", "tag_list"=>"food, corporations", "organization_website"=>"http://enterprise.net", "historic_and_current_context"=>"Historic.", "activities_short_description"=>"Activies.", "acronym"=>"E", "foundation_year"=>"1995",}
  198 +
  199 + assert_response :redirect
  200 + assert_redirected_to :controller => 'profile_editor', :action => 'index'
  201 + end
  202 +
194 203 should 'display profile publication option in edit profile screen' do
195 204 get :edit, :profile => profile.identifier
196 205 assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'true' }
... ...