diff options
author | Francis Irving <francis@mysociety.org> | 2010-07-15 14:56:24 +0100 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2010-07-15 14:56:24 +0100 |
commit | 4686732f95698eaa3c92fd8540236d35802d374f (patch) | |
tree | 3c0d062a271e9811a1401ef1d7104af1f07437b1 | |
parent | 8b8d61403afa9ff4263077a756ad3f09b22e722a (diff) |
Fix tests to use mock user.
-rw-r--r-- | spec/models/profile_photo_spec.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/spec/models/profile_photo_spec.rb b/spec/models/profile_photo_spec.rb index 7811fb5fc..428215a7c 100644 --- a/spec/models/profile_photo_spec.rb +++ b/spec/models/profile_photo_spec.rb @@ -3,21 +3,22 @@ require File.dirname(__FILE__) + '/../spec_helper' describe ProfilePhoto, "when constructing a new photo" do before do + @mock_user = mock_model(User) end it 'should take no image as invalid' do - profile_photo = ProfilePhoto.new(:data => nil) + profile_photo = ProfilePhoto.new(:data => nil, :user => @mock_user) profile_photo.valid?.should == false end it 'should take bad binary data as invalid' do - profile_photo = ProfilePhoto.new(:data => 'blahblahblah') + profile_photo = ProfilePhoto.new(:data => 'blahblahblah', :user => @mock_user) profile_photo.valid?.should == false end it 'should accept and convert a PNG to right size' do data = load_file_fixture("parrot.png") - profile_photo = ProfilePhoto.new(:data => data) + profile_photo = ProfilePhoto.new(:data => data, :user => @mock_user) profile_photo.valid?.should == true profile_photo.image.format.should == 'PNG' profile_photo.image.columns.should == 96 @@ -26,7 +27,7 @@ describe ProfilePhoto, "when constructing a new photo" 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) + profile_photo = ProfilePhoto.new(:data => data, :user => @mock_user) profile_photo.valid?.should == true profile_photo.image.format.should == 'PNG' profile_photo.image.columns.should == 96 |