aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authortony <tony>2009-03-19 15:02:15 +0000
committertony <tony>2009-03-19 15:02:15 +0000
commit91e4b7151faf91b0956508133d6a464d9592db9b (patch)
treed90ee0ff1d44087daa01473a78713bf269b370fb /spec/controllers/request_controller_spec.rb
parent708224354b4dafed6683a28334f1cfa1adec10e6 (diff)
Test that banned user can't create new request
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index db84c33e8..1d71e438a 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -226,6 +226,7 @@ describe RequestController, "when making a new request" do
before do
@user = mock_model(User, :id => 3481, :name => 'Testy')
+ @user.stub!(:get_undescribed_requests).and_return([])
@user.stub!(:can_file_requests?).and_return(true)
User.stub!(:find).and_return(@user)
@@ -235,7 +236,6 @@ describe RequestController, "when making a new request" do
it "should allow you to have one undescribed request" do
@user.stub!(:get_undescribed_requests).and_return([ 1 ])
-
session[:user_id] = @user.id
get :new, :public_body_id => @body.id
response.should render_template('new')
@@ -243,12 +243,19 @@ describe RequestController, "when making a new request" do
it "should fail if more than one request undescribed" do
@user.stub!(:get_undescribed_requests).and_return([ 1, 2 ])
-
session[:user_id] = @user.id
get :new, :public_body_id => @body.id
response.should render_template('new_please_describe')
end
+ it "should fail if user is banned" do
+ @user.stub!(:can_file_requests?).and_return(false)
+ @user.should_receive(:can_fail_html).and_return('FAIL!')
+ session[:user_id] = @user.id
+ get :new, :public_body_id => @body.id
+ response.should render_template('user/banned')
+ end
+
end
describe RequestController, "when viewing an individual response for reply/followup" do