Commit 2c81d81aff63a10e6e5e06307c2822f4412099e2

Authored by Antonio Terceiro
1 parent 68934890

ActionItem1126: resist an empty identifier

app/controllers/my_profile/profile_editor_controller.rb
... ... @@ -22,6 +22,9 @@ class ProfileEditorController < MyProfileController
22 22 end
23 23 end
24 24 rescue
  25 + if profile.identifier.blank?
  26 + profile.identifier = params[:profile]
  27 + end
25 28 flash[:notice] = _('Cannot update profile')
26 29 end
27 30 end
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -757,4 +757,12 @@ class ProfileEditorControllerTest < Test::Unit::TestCase
757 757 assert_redirected_to :action => 'index', :profile => 'new_address'
758 758 end
759 759  
  760 + should 'not crash if identifier is left blank' do
  761 + c = Community.create!(:name => 'test community', :identifier => 'test_comm')
  762 + assert_nothing_raised do
  763 + post :edit, :profile => c.identifier, :profile_data => c.attributes.merge('identifier' => '')
  764 + end
  765 + assert_response :success
  766 + end
  767 +
760 768 end
... ...