From dc3c642e889f887e46873ae78967ec7c893c9c1b Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 2 Dec 2011 15:50:16 +0000 Subject: When listing public bodies, instead of showing only those with translations in the current locale, show all those that have entries in the default locale. When there is no translation present for a locale, it will fall back to the default translation. Fixes #280. --- spec/controllers/public_body_controller_spec.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (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 ec56707be..53e6c169a 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -68,6 +68,19 @@ describe PublicBodyController, "when listing bodies" do response.should be_success end + it "should list all bodies even when there are no translations for selected locale" do + PublicBody.with_locale(:es) do + + spanish_only = PublicBody.new(:name => 'Spanish only', + :short_name => 'SO', + :request_email => 'spanish@flourish.org', + :last_edit_editor => 'test', + :last_edit_comment => '') + end + get :list + assigns[:public_bodies].length.should == 3 + end + it "should list bodies in alphabetical order" do get :list @@ -110,7 +123,7 @@ describe PublicBodyController, "when listing bodies" do 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].count.should == 2 -- cgit v1.2.3