aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/public_body_controller_spec.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-12-02 15:50:16 +0000
committerSeb Bacon <seb.bacon@gmail.com>2011-12-02 15:50:16 +0000
commitdc3c642e889f887e46873ae78967ec7c893c9c1b (patch)
treefc541d86b9499bd91599c70b42663991f9b69dbe /spec/controllers/public_body_controller_spec.rb
parent596b6bf103fac01781913373c1740e95daba57b2 (diff)
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.
Diffstat (limited to 'spec/controllers/public_body_controller_spec.rb')
-rw-r--r--spec/controllers/public_body_controller_spec.rb15
1 files changed, 14 insertions, 1 deletions
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