aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-09-10 13:54:52 +0100
committerMark Longair <mhl@pobox.com>2013-09-10 15:00:05 +0100
commit6395868beaaefb5525c19ce8b5deeaeb61925883 (patch)
treeda06cf0b992586e094828d50f6c637e5bef0950f
parent9692b2069aa32e5663412c714a98192ac5d6e754 (diff)
Add tests to assert the new public body listing behaviour
These tests will fail unless we have the new behaviour for public body listing, which depend on the setting of PUBLIC_BODY_LIST_FALLBACK_TO_DEFAULT_LOCALE.
-rw-r--r--spec/controllers/public_body_controller_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb
index 2b921b488..1700053fb 100644
--- a/spec/controllers/public_body_controller_spec.rb
+++ b/spec/controllers/public_body_controller_spec.rb
@@ -92,6 +92,20 @@ describe PublicBodyController, "when listing bodies" do
assigns[:public_bodies].include?(@english_only).should == true
end
+ it 'if fallback is requested, should still list public bodies only with translations in the current locale' do
+ AlaveteliConfiguration.stub!(:public_body_list_fallback_to_default_locale).and_return(true)
+ I18n.with_locale(:es) do
+ @spanish_only = PublicBody.new(:name => 'Español Solamente',
+ :short_name => 'ES',
+ :request_email => 'spanish@flourish.org',
+ :last_edit_editor => 'test',
+ :last_edit_comment => '')
+ @spanish_only.save
+ end
+ get :list, {:locale => 'es'}
+ assigns[:public_bodies].include?(@spanish_only).should == true
+ end
+
it 'should show public body names in the selected locale language if present' do
get :list, {:locale => 'es'}
response.should contain('El Department for Humpadinking')