aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/user_controller_spec.rb
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-07-14 01:12:29 +0100
committerFrancis Irving <francis@mysociety.org>2010-07-14 01:12:29 +0100
commitd82960021cbe2c4501be1012e2d040b76c728e23 (patch)
tree4c67a4abeb1105e78a5fca3d33168a3322e15702 /spec/controllers/user_controller_spec.rb
parent55a4eb4e26992eb77c4d89f41846607a59357c73 (diff)
Get picture posting to work
Diffstat (limited to 'spec/controllers/user_controller_spec.rb')
-rw-r--r--spec/controllers/user_controller_spec.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index cdd911ec7..19225c6ae 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -460,7 +460,7 @@ describe UserController, "when using profile photos" do
it "should not let you change profile photo if you're not logged in as the user" do
user = users(:bob_smith_user)
data = load_file_fixture("parrot.png")
- post :profile_photo, { :id => user.id, :data => data }
+ post :profile_photo, { :id => user.id, :file => data }
end
it "should let you change profile photo if you're logged in as the user" do
@@ -468,10 +468,14 @@ describe UserController, "when using profile photos" do
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 }
+ tempfile = File.open(file_fixture_name("parrot.png"))
+ tempfile.stub!(:original_filename).and_return('parrot.png')
+ post :profile_photo, { :id => user.id, :file => tempfile, :submitted_profile_photo => 1 }
response.should redirect_to(:controller => 'user', :action => 'show', :url_name => "bob_smith")
+ flash[:notice].should match(/Thank you for updating your profile photo/)
+
+ user.reload
user.profile_photo.should_not be_nil
end
end