aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-11-17 14:11:36 +0000
committerGareth Rees <gareth@mysociety.org>2014-11-17 14:11:36 +0000
commit58c6e4f68e3d1e3fa6ade5266b38f6535dd95a02 (patch)
treeaa6c2b43eec1f212a049d3eeac19419df3733395 /spec/controllers
parente09f967869bc53751a98bfe2cd88d81feca1423f (diff)
Provide expectations for controller specs
This commit adds expectations to AdminPublicBodyCategoriesController and AdminPublicBodyHeadingsController edit actions
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin_public_body_categories_controller_spec.rb13
-rw-r--r--spec/controllers/admin_public_body_headings_controller_spec.rb8
2 files changed, 17 insertions, 4 deletions
diff --git a/spec/controllers/admin_public_body_categories_controller_spec.rb b/spec/controllers/admin_public_body_categories_controller_spec.rb
index 35454990d..1e2a8d116 100644
--- a/spec/controllers/admin_public_body_categories_controller_spec.rb
+++ b/spec/controllers/admin_public_body_categories_controller_spec.rb
@@ -82,14 +82,21 @@ describe AdminPublicBodyCategoriesController do
render_views
- it "edits a public body category" do
+ it "finds the requested category" do
get :edit, :id => @category.id
+ expect(assigns[:category]).to eq(@category)
+ end
+
+ it "renders the edit template" do
+ get :edit, :id => @category.id
+ expect(assigns[:category]).to render_template('edit')
end
it "edits a public body in another locale" do
- get :edit, {:id => @category.id, :locale => :en}
+ get :edit, { :id => @category.id, :locale => :en }
- # When editing a body, the controller returns all available translations
+ # When editing a body, the controller returns all available
+ # translations
assigns[:category].find_translation_by_locale("es").title.should == 'Los category'
response.should render_template('edit')
end
diff --git a/spec/controllers/admin_public_body_headings_controller_spec.rb b/spec/controllers/admin_public_body_headings_controller_spec.rb
index 31517d238..39d524013 100644
--- a/spec/controllers/admin_public_body_headings_controller_spec.rb
+++ b/spec/controllers/admin_public_body_headings_controller_spec.rb
@@ -54,8 +54,14 @@ describe AdminPublicBodyHeadingsController do
render_views
- it "edits a public body heading" do
+ it "finds the requested heading" do
get :edit, :id => @heading.id
+ expect(assigns[:heading]).to eq(@heading)
+ end
+
+ it "renders the edit template" do
+ get :edit, :id => @heading.id
+ expect(assigns[:heading]).to render_template('edit')
end
end