diff options
author | lizconlan <liz@mysociety.org> | 2014-07-24 14:24:58 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-09-22 12:39:03 +0100 |
commit | 7a7a57349432d01a99d6ba96cc7a4a130411a3b8 (patch) | |
tree | f077d2f8340b690517db7b01a5b1a592a1cc401a /spec/controllers | |
parent | cb2dfa0c464e72c4d0eb00e5381e9d24c57d63e2 (diff) |
Enable admins to link public body categories to headings
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/admin_public_body_category_controller_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/controllers/admin_public_body_category_controller_spec.rb b/spec/controllers/admin_public_body_category_controller_spec.rb index dbc72ac93..d13ebcaaf 100644 --- a/spec/controllers/admin_public_body_category_controller_spec.rb +++ b/spec/controllers/admin_public_body_category_controller_spec.rb @@ -85,6 +85,8 @@ describe AdminPublicBodyCategoryController do @category = PublicBodyCategory.find_by_title("Useless ministries") end + render_views + it "saves edits to a public body category" do post :update, { :id => @category.id, :public_body_category => { :title => "Renamed" } } @@ -93,6 +95,18 @@ describe AdminPublicBodyCategoryController do pbc.title.should == "Renamed" end + it "saves edits to a public body category's heading associations" do + @category.public_body_headings.count.should == 1 + @category.public_body_headings.first.name.should == "Silly ministries" + heading = PublicBodyHeading.find_by_name("Popular agencies") + post :update, { :id => @category.id, + :public_body_category => { :title => "Renamed" }, + :headings => {"heading_#{heading.id}" => heading.id} } + request.flash[:notice].should include('successful') + pbc = PublicBodyCategory.find(@category.id) + pbc.public_body_headings.should == [heading] + end + it "saves edits to a public body category in another locale" do I18n.with_locale(:es) do @category.title.should == 'Los useless ministries' |