diff options
author | francis <francis> | 2008-03-19 03:44:36 +0000 |
---|---|---|
committer | francis <francis> | 2008-03-19 03:44:36 +0000 |
commit | d982dfb6418c772c6aff0ef7f4f9b6f71a6c6f7c (patch) | |
tree | f87f44098b943326deb617d7c09c0312d16782d0 | |
parent | 879cc2fe24ee7f173ac0bc9432cc87aaf681354a (diff) |
Test listing public bodies, with tags.
-rw-r--r-- | spec/controllers/body_controller_spec.rb | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/spec/controllers/body_controller_spec.rb b/spec/controllers/body_controller_spec.rb index 672042f9b..c18797275 100644 --- a/spec/controllers/body_controller_spec.rb +++ b/spec/controllers/body_controller_spec.rb @@ -24,6 +24,51 @@ describe BodyController, "when showing a body" do response.should redirect_to(:controller => 'body', :action => 'show', :url_name => "dfh") end - # XXX test for 404s when don't give valid name - # XXX test the fancy history searching stuff + it "should redirect to lower case name if you use mixed case name in URL" do + get :show, :url_name => "dFh" + response.should redirect_to(:controller => 'body', :action => 'show', :url_name => "dfh") + end end + +describe BodyController, "when listing bodies" do + integrate_views + fixtures :public_bodies, :public_body_versions + + it "should be successful" do + get :list + response.should be_success + end + + it "should list bodies in alphabetical order" do + get :list + + response.should render_template('list') + + assigns[:public_bodies].should == [ public_bodies(:humpadink_public_body), public_bodies(:geraldine_public_body) ] + assigns[:tag].should be_nil + assigns[:description].should == "All" + 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 + public_bodies(:humpadink_public_body).tag_string = "foo local_council" + + get :list, :tag => "local_council" + response.should render_template('list') + assigns[:public_bodies].should == [ public_bodies(:humpadink_public_body) ] + assigns[:tag].should == "local_council" + assigns[:description].should == "Local Councils" + + get :list, :tag => "other" + response.should render_template('list') + assigns[:public_bodies].should == [ public_bodies(:geraldine_public_body) ] + + get :list + response.should render_template('list') + assigns[:public_bodies].should == [ public_bodies(:humpadink_public_body), public_bodies(:geraldine_public_body) ] + + end + +end + + + |