diff --git a/lib/acts_as_having_image.rb b/lib/acts_as_having_image.rb index 735b142..99580df 100644 --- a/lib/acts_as_having_image.rb +++ b/lib/acts_as_having_image.rb @@ -12,7 +12,7 @@ module ActsAsHavingImage image.attributes = img else build_image(img) - end + end unless img[:uploaded_data].blank? end end diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 1187bf1..29bbea0 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -1352,6 +1352,16 @@ class ProfileTest < Test::Unit::TestCase assert !profile.valid? end + should 'profile be valid when image is empty' do + profile = Profile.create!(:name => 'Profile for testing ', :identifier => 'profilefortesting', :image_builder => {:uploaded_data => ""}) + assert_valid profile + end + + should 'profile be valid when has no image' do + profile = Profile.create!(:name => 'Profile for testing ', :identifier => 'profilefortesting') + assert_valid profile + end + should 'copy header and footer after create a person' do template = create_user('template').person template.custom_footer = "footer customized" -- libgit2 0.21.2