aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/user_controller.rb3
-rw-r--r--spec/controllers/user_controller_spec.rb7
2 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 45b71a3a9..f49fc9165 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -489,7 +489,8 @@ class UserController < ApplicationController
raise ActiveRecord::RecordNotFound.new("user not found, url_name=" + params[:url_name])
end
if !@display_user.profile_photo
- raise "user has no profile photo, url_name=" + params[:url_name]
+ raise ActiveRecord::RecordNotFound.new("user has no profile photo, url_name=" + params[:url_name])
+
end
response.content_type = "image/png"
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 0cf574aa9..2b5fb17e3 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -526,6 +526,13 @@ describe UserController, "when using profile photos" do
post :set_profile_photo, { :id => @user.id, :file => @uploadedfile, :submitted_draft_profile_photo => 1, :automatically_crop => 1 }
end
+ it "should return a 404 not a 500 when a profile photo has not been set" do
+ @user.profile_photo.should be_nil
+ lambda {
+ get :get_profile_photo, {:url_name => @user.url_name }
+ }.should raise_error(ActiveRecord::RecordNotFound)
+ end
+
it "should let you change profile photo if you're logged in as the user" do
@user.profile_photo.should be_nil
session[:user_id] = @user.id