diff options
Diffstat (limited to 'spec/controllers/public_body_controller_spec.rb')
-rw-r--r-- | spec/controllers/public_body_controller_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index fbab832f6..6b55bc09a 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -4,7 +4,7 @@ require 'json' describe PublicBodyController, "when showing a body" do integrate_views - fixtures :public_bodies, :public_body_versions + fixtures :public_bodies, :public_body_versions, :public_body_translations it "should be successful" do get :show, :url_name => "dfh" @@ -21,6 +21,16 @@ describe PublicBodyController, "when showing a body" do assigns[:public_body].should == public_bodies(:humpadink_public_body) end + it "should assign the body using different locale from that used for url_name" do + get :show, {:url_name => "dfh", :locale => 'es'} + assigns[:public_body].notes.should == "Baguette" + end + + it "should assign the body using same locale as that used in url_name" do + get :show, {:url_name => "edfh", :locale => 'es'} + assigns[:public_body].notes.should == "Baguette" + end + it "should redirect to newest name if you use historic name of public body in URL" do get :show, :url_name => "hdink" response.should redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh") @@ -51,6 +61,16 @@ describe PublicBodyController, "when listing bodies" do assigns[:description].should == "all" end + it "should list bodies in alphabetical order with different locale" do + get :list, :locale => "es" + + response.should render_template('list') + + assigns[:public_bodies].should == [ public_bodies(:geraldine_public_body), public_bodies(:humpadink_public_body) ] + assigns[:tag].should == "all" + 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" |