From 0610eeb4597138723cce97dcd0c4702a0de0dbcd Mon Sep 17 00:00:00 2001 From: francis Date: Wed, 5 Aug 2009 16:31:10 +0000 Subject: Some (as yet unused) profile photo code done on a whim on the train while it was my birthday. --- spec/models/user_spec.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'spec/models/user_spec.rb') diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index db7753469..7de181300 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -216,3 +216,35 @@ describe User, " when making name and email address" do end +describe User, " when setting a profile photo" do + before do + @user = User.new + @user.name = "Sensible User" + @user.email = "sensible@localhost" + @user.password = "sensiblepassword" + end + + it "should attach it to the user" do + data = load_image_fixture("parrot.png") + profile_photo = ProfilePhoto.new(:data => data) + @user.set_profile_photo(profile_photo) + profile_photo.user.should == @user + end + +# it "should destroy old photos being replaced" do +# ProfilePhoto.count.should == 0 +# +# data_1 = load_image_fixture("parrot.png") +# profile_photo_1 = ProfilePhoto.new(:data => data_1) +# data_2 = load_image_fixture("parrot.jpg") +# profile_photo_2 = ProfilePhoto.new(:data => data_2) +# +# @user.set_profile_photo(profile_photo_1) +# @user.save! +# ProfilePhoto.count.should == 1 +# @user.set_profile_photo(profile_photo_2) +# @user.save! +# ProfilePhoto.count.should == 1 +# end +end + -- cgit v1.2.3