aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/profile_photo_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/profile_photo_spec.rb')
-rw-r--r--spec/models/profile_photo_spec.rb22
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