aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/admin_public_body_category_controller_spec.rb14
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'