aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/user/profile_photo.rhtml4
-rw-r--r--spec/controllers/user_controller_spec.rb12
2 files changed, 14 insertions, 2 deletions
diff --git a/app/views/user/profile_photo.rhtml b/app/views/user/profile_photo.rhtml
index 67b7a0f75..b3daafd4c 100644
--- a/app/views/user/profile_photo.rhtml
+++ b/app/views/user/profile_photo.rhtml
@@ -8,10 +8,10 @@
<div id="profile_photo">
-<% form_tag 'profile_photo', :html => { :id => 'profile_photo_form' }, :multipart => true do %>
+<% form_tag 'profile_photo', :id => 'profile_photo_form', :multipart => true do %>
<p>
<label class="form_label" for="file_1">Photo of you:</label>
- <%= file_field_tag :file, :size => 35 %>
+ <%= file_field_tag :file, :size => 35, :id => 'file_1' %>
</p>
<p><strong>Privacy note:</strong> Your photo will be shown in public on the Internet,
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 5d436fc9c..cdd911ec7 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -462,5 +462,17 @@ describe UserController, "when using profile photos" do
data = load_file_fixture("parrot.png")
post :profile_photo, { :id => user.id, :data => data }
end
+
+ it "should let you change profile photo if you're logged in as the user" do
+ user = users(:bob_smith_user)
+ user.profile_photo.should be_nil
+
+ session[:user_id] = user.id
+ data = load_file_fixture("parrot.png")
+ post :profile_photo, { :id => user.id, :data => data }
+
+ response.should redirect_to(:controller => 'user', :action => 'show', :url_name => "bob_smith")
+ user.profile_photo.should_not be_nil
+ end
end