Commit 85f62237d13fb68c52d5c0068a218f4b0f614a73

Authored by Moises Machado
Committed by Antonio Terceiro
1 parent 9b1f10f9

ActionItem1183: fixed error with profile saved without image

lib/acts_as_having_image.rb
... ... @@ -12,7 +12,7 @@ module ActsAsHavingImage
12 12 image.attributes = img
13 13 else
14 14 build_image(img)
15   - end
  15 + end unless img[:uploaded_data].blank?
16 16 end
17 17  
18 18 end
... ...
test/unit/profile_test.rb
... ... @@ -1352,6 +1352,16 @@ class ProfileTest < Test::Unit::TestCase
1352 1352 assert !profile.valid?
1353 1353 end
1354 1354  
  1355 + should 'profile be valid when image is empty' do
  1356 + profile = Profile.create!(:name => 'Profile for testing ', :identifier => 'profilefortesting', :image_builder => {:uploaded_data => ""})
  1357 + assert_valid profile
  1358 + end
  1359 +
  1360 + should 'profile be valid when has no image' do
  1361 + profile = Profile.create!(:name => 'Profile for testing ', :identifier => 'profilefortesting')
  1362 + assert_valid profile
  1363 + end
  1364 +
1355 1365 should 'copy header and footer after create a person' do
1356 1366 template = create_user('template').person
1357 1367 template.custom_footer = "footer customized"
... ...