diff options
author | francis <francis> | 2009-10-01 01:43:36 +0000 |
---|---|---|
committer | francis <francis> | 2009-10-01 01:43:36 +0000 |
commit | 705ebd5cb64908a336bab16b190d36ff0456fded (patch) | |
tree | 670eabfc0fccda88db37a590820ec3f1b85f2581 /spec/controllers/request_controller_spec.rb | |
parent | 5fb1cd5857040d4859237013123aa4aec250250a (diff) |
Let some users leave requests undescribed.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index c84673b23..917826d45 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -376,6 +376,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_leave_requests_undescribed?).and_return(false) @user.stub!(:can_file_requests?).and_return(true) User.stub!(:find).and_return(@user) @@ -385,6 +386,7 @@ 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 ]) + @user.stub!(:can_leave_requests_undescribed?).and_return(false) session[:user_id] = @user.id get :new, :public_body_id => @body.id response.should render_template('new') @@ -392,11 +394,20 @@ 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 ]) + @user.stub!(:can_leave_requests_undescribed?).and_return(false) session[:user_id] = @user.id get :new, :public_body_id => @body.id response.should render_template('new_please_describe') end + it "should allow you if more than one request undescribed but are allowed to leave requests undescribed" do + @user.stub!(:get_undescribed_requests).and_return([ 1, 2 ]) + @user.stub!(:can_leave_requests_undescribed?).and_return(true) + session[:user_id] = @user.id + get :new, :public_body_id => @body.id + response.should render_template('new') + 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!') |