aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/request_controller_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-10-23 11:19:13 +0100
committerLouise Crow <louise.crow@gmail.com>2013-12-04 09:32:41 +0000
commit0aba4dcbcb19be2c2c66e40f051ae9c4e0283b6e (patch)
tree2b532a7c458b06c5f0de02f9976b59f69e126ec0 /spec/controllers/request_controller_spec.rb
parentacb186466b20172a6804f86f8a082f148ec50fc6 (diff)
Require at least one public body in the params.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
-rw-r--r--spec/controllers/request_controller_spec.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index d92eb6aa2..2fa6603d2 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -2521,23 +2521,29 @@ describe RequestController, "#new_batch", :focus => true do
before do
@user = FactoryGirl.create(:user, :can_make_batch_requests => true)
+ @public_body = FactoryGirl.create(:public_body)
end
it 'should be successful' do
- get :new_batch, {}, {:user_id => @user.id}
+ get :new_batch, {:public_body_ids => [@public_body.id]}, {:user_id => @user.id}
response.should be_success
end
it 'should render the "new" template' do
- get :new_batch, {}, {:user_id => @user.id}
+ get :new_batch, {:public_body_ids => [@public_body.id]}, {:user_id => @user.id}
response.should render_template('request/new')
end
+ it 'should redirect to "select_authorities" if no public_body_ids param is passed' do
+ get :new_batch, {}, {:user_id => @user.id}
+ response.should redirect_to select_authorities_path
+ end
it "should render 'preview' when given a good title and body" do
post :new_batch, { :info_request => { :title => "What does it all mean?",
:tag_string => "" },
+ :public_body_ids => [@public_body.id],
:outgoing_message => { :body => "This is a silly letter." },
:submitted_new_request => 1,
:preview => 1 }, { :user_id => @user.id }
@@ -2546,6 +2552,7 @@ describe RequestController, "#new_batch", :focus => true do
it "should give an error and render 'new' template when a summary isn't given" do
post :new_batch, { :info_request => { :tag_string => "" },
+ :public_body_ids => [@public_body.id],
:outgoing_message => { :body => "This is a silly letter." },
:submitted_new_request => 1,
:preview => 1 }, { :user_id => @user.id }
@@ -2555,6 +2562,7 @@ describe RequestController, "#new_batch", :focus => true do
it "should allow re-editing of a request" do
post :new_batch, { :info_request => { :tag_string => "" },
+ :public_body_ids => [@public_body.id],
:outgoing_message => { :body => "This is a silly letter." },
:submitted_new_request => 1,
:preview => 0,