Commit 5efe2b44ab6e087c43ccad2cc3d6a79c9e095503

Authored by Antonio Terceiro
1 parent 26c87582

ActionItem1178: fixing profile image tests

Probably Rails 2.1 changed the way the validation on associated objects
works. But eberything is fine now.
Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
test/unit/profile_test.rb
@@ -1341,13 +1341,13 @@ class ProfileTest < Test::Unit::TestCase @@ -1341,13 +1341,13 @@ class ProfileTest < Test::Unit::TestCase
1341 1341
1342 should 'validates profile image when save' do 1342 should 'validates profile image when save' do
1343 profile = Profile.create!(:name => 'Profile for testing ', :identifier => 'profilefortesting', :image_builder => {:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')}) 1343 profile = Profile.create!(:name => 'Profile for testing ', :identifier => 'profilefortesting', :image_builder => {:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')})
1344 - profile.image.expects(:valid?)  
1345 - assert profile.valid? 1344 + profile.image.expects(:valid?).returns(false).at_least_once
  1345 + assert !profile.valid?
1346 end 1346 end
1347 1347
1348 should 'profile is invalid when image not valid' do 1348 should 'profile is invalid when image not valid' do
1349 profile = Profile.create!(:name => 'Profile for testing ', :identifier => 'profilefortesting', :image_builder => {:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')}) 1349 profile = Profile.create!(:name => 'Profile for testing ', :identifier => 'profilefortesting', :image_builder => {:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')})
1350 - profile.image.expects(:valid?) 1350 + profile.image.expects(:valid?).returns(false).at_least_once
1351 profile.image.errors.add(:size, "fake error") 1351 profile.image.errors.add(:size, "fake error")
1352 assert !profile.valid? 1352 assert !profile.valid?
1353 end 1353 end