From 21e17c404bfd4ab900045589a751c7010e223609 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 29 May 2014 10:52:23 +0200 Subject: Redirect to the frontpage rather than error on invalid params Fixes #1448. --- spec/controllers/request_controller_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec/controllers/request_controller_spec.rb') diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 9353efcb3..070511fb0 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -1007,6 +1007,17 @@ describe RequestController, "when creating a new request" do # post_redirect.post_params.should == params # XXX get this working. there's a : vs '' problem amongst others end + it 'redirects to the frontpage if the action is sent the invalid + public_body param' do + post :new, :info_request => { :public_body => @body.id, + :title => 'Why Geraldine?', + :tag_string => '' }, + :outgoing_message => { :body => 'This is a silly letter.' }, + :submitted_new_request => 1, + :preview => 1 + response.should redirect_to frontpage_url + end + it "should show preview when input is good" do session[:user_id] = @user.id post :new, { :info_request => { :public_body_id => @body.id, -- cgit v1.2.3