From fd82802023fec28c0e467c0ba2820489d35ddc9c Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Wed, 24 Sep 2014 17:44:43 +0100 Subject: fixup! Replace existing PublicBodyCategories functionality with db models PublicBodyCategory and PublicBodyHeading --- spec/controllers/public_body_controller_spec.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'spec/controllers/public_body_controller_spec.rb') diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index 6ff1a7215..fc7143522 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -209,16 +209,19 @@ describe PublicBodyController, "when listing bodies" do end end - it "should list a tagged thing on the appropriate list page, and others on the other page, and all still on the all page" do - load_test_categories - - public_bodies(:humpadink_public_body).tag_string = "foo local_council" - - get :list, :tag => "local_council" + it "should list a tagged thing on the appropriate list page, and others on the other page, + and all still on the all page" do + category = FactoryGirl.create(:public_body_category) + heading = FactoryGirl.create(:public_body_heading) + PublicBodyCategoryLink.create(:public_body_heading_id => heading.id, + :public_body_category_id => category.id) + public_bodies(:humpadink_public_body).tag_string = category.category_tag + + get :list, :tag => category.category_tag response.should render_template('list') assigns[:public_bodies].should == [ public_bodies(:humpadink_public_body) ] - assigns[:tag].should == "local_council" - assigns[:description].should == "in the category ‘Local councils’" + assigns[:tag].should == category.category_tag + assigns[:description].should == "in the category ‘#{category.title}’" get :list, :tag => "other" response.should render_template('list') -- cgit v1.2.3