diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-01-27 12:09:23 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-01-27 12:09:23 +0000 |
commit | c17f99038cd24632933f3713213dc50830b29cec (patch) | |
tree | 87f7edd9b26b68a7318c2d386bcd4ada6c58af61 /spec/models | |
parent | 931e3246299eec2ef35ad1fc7e7dbfe24965f01a (diff) | |
parent | 4ce72d27785ba39fb8571376a84569f508b6feaf (diff) |
Merge branch 'feature/fix-profile-photo-errors' into rails-3-develop
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/profile_photo_spec.rb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/spec/models/profile_photo_spec.rb b/spec/models/profile_photo_spec.rb index 0e157e2c5..e70f474a0 100644 --- a/spec/models/profile_photo_spec.rb +++ b/spec/models/profile_photo_spec.rb @@ -10,12 +10,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -describe ProfilePhoto, "when constructing a new photo" do +describe ProfilePhoto, "when constructing a new photo" do - before do + before do @mock_user = mock_model(User) end - + it 'should take no image as invalid' do profile_photo = ProfilePhoto.new(:data => nil, :user => @mock_user) profile_photo.valid?.should == false @@ -26,7 +26,15 @@ describe ProfilePhoto, "when constructing a new photo" do profile_photo.valid?.should == false end - it 'should accept and convert a PNG to right size' do + it 'should translate a no image error message' do + I18n.with_locale(:es) do + profile_photo = ProfilePhoto.new(:data => nil, :user => @mock_user) + profile_photo.valid?.should == false + profile_photo.errors[:data].should == ['Por favor elige el fichero que contiene tu foto'] + end + end + + it 'should accept and convert a PNG to right size' do data = load_file_fixture("parrot.png") profile_photo = ProfilePhoto.new(:data => data, :user => @mock_user) profile_photo.valid?.should == true @@ -35,7 +43,7 @@ describe ProfilePhoto, "when constructing a new photo" do profile_photo.image.rows.should == 96 end - it 'should accept and convert a JPEG to right format and size' do + it 'should accept and convert a JPEG to right format and size' do data = load_file_fixture("parrot.jpg") profile_photo = ProfilePhoto.new(:data => data, :user => @mock_user) profile_photo.valid?.should == true @@ -44,7 +52,7 @@ describe ProfilePhoto, "when constructing a new photo" do profile_photo.image.rows.should == 96 end - it 'should accept a draft PNG and not resize it' do + it 'should accept a draft PNG and not resize it' do data = load_file_fixture("parrot.png") profile_photo = ProfilePhoto.new(:data => data, :draft => true) profile_photo.valid?.should == true @@ -53,6 +61,6 @@ describe ProfilePhoto, "when constructing a new photo" do profile_photo.image.rows.should == 289 end - + end |