diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-11-17 14:23:46 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-11-17 14:23:46 +0000 |
commit | 35c5692568a0aca1e5a8aa1b0df303019a792dc6 (patch) | |
tree | b315c4b89efce2b279261fb8a70023d4e890f8dd /spec/controllers | |
parent | 58c6e4f68e3d1e3fa6ade5266b38f6535dd95a02 (diff) |
Redirect to #edit after updating
On a successful update AdminPublicBodyHeadingsController and
AdminPublicBodyCategoriesController #update should redirect to the #edit
action rather than simply rendering the ‘edit’ template.
Fixes https://github.com/mysociety/alaveteli/issues/1977
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/admin_public_body_categories_controller_spec.rb | 8 | ||||
-rw-r--r-- | spec/controllers/admin_public_body_headings_controller_spec.rb | 8 |
2 files changed, 16 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 1e2a8d116..58e87d441 100644 --- a/spec/controllers/admin_public_body_categories_controller_spec.rb +++ b/spec/controllers/admin_public_body_categories_controller_spec.rb @@ -182,6 +182,14 @@ describe AdminPublicBodyCategoriesController do pbc = PublicBodyCategory.find(category.id) pbc.category_tag.should == "renamed" end + + it "redirects to the edit page after a successful update" do + post :update, { :id => @category.id, + :public_body_category => { :title => "Renamed" } } + + expect(response).to redirect_to(edit_admin_category_path(@category)) + 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 39d524013..7058e1ab8 100644 --- a/spec/controllers/admin_public_body_headings_controller_spec.rb +++ b/spec/controllers/admin_public_body_headings_controller_spec.rb @@ -102,6 +102,14 @@ describe AdminPublicBodyHeadingsController do heading.name.should == @name end end + + it "redirects to the edit page after a successful update" do + post :update, { :id => @heading.id, + :public_body_heading => { :name => "Renamed" } } + + expect(response).to redirect_to(edit_admin_heading_path(@heading)) + end + end context 'when destroying a public body heading' do |