From 0d740187fabb723c32f2ddd83b7b950e84bc6861 Mon Sep 17 00:00:00 2001 From: Daniel Bucher Date: Thu, 5 Jun 2014 19:26:25 -0300 Subject: [PATCH] profile_editor: added mass-assign support for enterprise fields --- app/models/enterprise.rb | 2 ++ test/functional/profile_editor_controller_test.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index f9e0b32..87baedd 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -2,6 +2,8 @@ # only enterprises can offer products and services. class Enterprise < Organization + attr_accessible :business_name, :address_reference, :district, :tag_list, :organization_website, :historic_and_current_context, :activities_short_description, :products_per_catalog_page + SEARCH_DISPLAYS += %w[map full] def self.type_name diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index b8d8277..8c02ab3 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -191,6 +191,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 enterprise fields' do + enterprise = fast_create(Enterprise) + + 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",} + + assert_response :redirect + assert_redirected_to :controller => 'profile_editor', :action => 'index' + end + should 'display profile publication option in edit profile screen' do get :edit, :profile => profile.identifier assert_tag :tag => 'input', :attributes => { :type => 'radio', :checked => 'checked', :name => 'profile_data[public_profile]', :value => 'true' } -- libgit2 0.21.2