diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-11-17 14:33:41 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-11-17 14:33:41 +0000 |
commit | b3d9ad08dbea1cfc22bbcb081a32634bf9ea7755 (patch) | |
tree | 95732c5b95278894e9fedeef2cdb4af81580aaab /spec/controllers | |
parent | 35c5692568a0aca1e5a8aa1b0df303019a792dc6 (diff) |
Redirect to #edit after updating
On an unsuccessful update AdminPublicBodyHeadingsController and
AdminPublicBodyCategoriesController #update should render the #edit
action.
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/admin_public_body_categories_controller_spec.rb | 7 | ||||
-rw-r--r-- | spec/controllers/admin_public_body_headings_controller_spec.rb | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/spec/controllers/admin_public_body_categories_controller_spec.rb b/spec/controllers/admin_public_body_categories_controller_spec.rb index 58e87d441..1e3419fcb 100644 --- a/spec/controllers/admin_public_body_categories_controller_spec.rb +++ b/spec/controllers/admin_public_body_categories_controller_spec.rb @@ -190,6 +190,13 @@ describe AdminPublicBodyCategoriesController do expect(response).to redirect_to(edit_admin_category_path(@category)) end + it "re-renders the edit form after an unsuccessful update" do + post :update, { :id => @category.id, + :public_body_category => { :title => '' } } + + expect(response).to render_template('edit') + end + end context 'when destroying a public body category' do diff --git a/spec/controllers/admin_public_body_headings_controller_spec.rb b/spec/controllers/admin_public_body_headings_controller_spec.rb index 7058e1ab8..9c4ea3855 100644 --- a/spec/controllers/admin_public_body_headings_controller_spec.rb +++ b/spec/controllers/admin_public_body_headings_controller_spec.rb @@ -110,6 +110,13 @@ describe AdminPublicBodyHeadingsController do expect(response).to redirect_to(edit_admin_heading_path(@heading)) end + it "re-renders the edit form after an unsuccessful update" do + post :update, { :id => @heading.id, + :public_body_heading => { :name => '' } } + + expect(response).to render_template('edit') + end + end context 'when destroying a public body heading' do |