aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/user_controller_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-03-30 16:00:02 +0100
committerLouise Crow <louise.crow@gmail.com>2015-03-30 16:00:02 +0100
commitf24cc98afa25ad6010ae5316eecc15dfdb3fa79b (patch)
treec32fecb16bb2097da7dfdf90e6915fce0bf1a425 /spec/controllers/user_controller_spec.rb
parent823e58dc69960c600230b10604a0051359173f85 (diff)
parent3c0604cf900ad274d8f6ff421d39854ccbf4b6af (diff)
Merge branch 'release/0.21'0.21.0.0
Conflicts: locale/cy/app.po locale/es_NI/app.po locale/hr/app.po locale/is_IS/app.po locale/sr@latin/app.po
Diffstat (limited to 'spec/controllers/user_controller_spec.rb')
-rw-r--r--spec/controllers/user_controller_spec.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 413d395c5..443856cf3 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -1,6 +1,63 @@
# coding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+describe UserController do
+
+ describe :set_profile_photo do
+
+ context 'user is banned' do
+
+ before(:each) do
+ @user = FactoryGirl.create(:user, :ban_text => 'Causing trouble')
+ session[:user_id] = @user.id
+ @uploadedfile = fixture_file_upload("/files/parrot.png")
+
+ post :set_profile_photo, :id => @user.id,
+ :file => @uploadedfile,
+ :submitted_draft_profile_photo => 1,
+ :automatically_crop => 1
+ end
+
+ it 'redirects to the profile page' do
+ expect(response).to redirect_to(set_profile_photo_path)
+ end
+
+ it 'renders an error message' do
+ msg = 'Banned users cannot edit their profile'
+ expect(flash[:error]).to eq(msg)
+ end
+
+ end
+
+ end
+
+ describe :set_profile_about_me do
+
+ context 'user is banned' do
+
+ before(:each) do
+ @user = FactoryGirl.create(:user, :ban_text => 'Causing trouble')
+ session[:user_id] = @user.id
+
+ post :set_profile_about_me, :submitted_about_me => '1',
+ :about_me => 'Bad stuff'
+ end
+
+ it 'redirects to the profile page' do
+ expect(response).to redirect_to(set_profile_about_me_path)
+ end
+
+ it 'renders an error message' do
+ msg = 'Banned users cannot edit their profile'
+ expect(flash[:error]).to eq(msg)
+ end
+
+ end
+
+ end
+
+end
+
# TODO: Use route_for or params_from to check /c/ links better
# http://rspec.rubyforge.org/rspec-rails/1.1.12/classes/Spec/Rails/Example/ControllerExampleGroup.html
describe UserController, "when redirecting a show request to a canonical url" do