diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/public_body_controller_spec.rb | 18 | ||||
-rw-r--r-- | spec/fixtures/public_body_translations.yml | 14 |
2 files changed, 32 insertions, 0 deletions
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index 68e02e000..4e1841164 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -48,6 +48,12 @@ describe PublicBodyController, "when showing a body" do response.should contain("Baguette") end + it 'should show public body names in the selected locale language if present for a locale with underscores' do + AlaveteliLocalization.set_locales('he_IL en', 'en') + get :show, {:url_name => 'dfh', :view => 'all', :locale => 'he_IL'} + response.should contain('Hebrew Humpadinking') + end + it "should redirect use to the relevant locale even when url_name is for a different locale" do get :show, {:url_name => "edfh", :view => 'all'} response.should redirect_to "http://test.host/body/dfh" @@ -85,6 +91,18 @@ describe PublicBodyController, "when listing bodies" do assigns[:public_bodies].include?(@english_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') + end + + it 'should show public body names in the selected locale language if present for a locale with underscores' do + AlaveteliLocalization.set_locales('he_IL en', 'en') + get :list, {:locale => 'he_IL'} + response.should contain('Hebrew Humpadinking') + end + + it "should list bodies in alphabetical order" do # Note that they are alphabetised by localised name get :list diff --git a/spec/fixtures/public_body_translations.yml b/spec/fixtures/public_body_translations.yml index 61e07fb5b..de1bf2f18 100644 --- a/spec/fixtures/public_body_translations.yml +++ b/spec/fixtures/public_body_translations.yml @@ -101,3 +101,17 @@ other_public_body_translation: notes: More notes publication_scheme: "" disclosure_log: "" + +humpadink_he_IL_public_body_translation: + name: "Hebrew Humpadinking" + first_letter: D + request_email: humpadink-requests@localhost + id: 9 + public_body_id: 3 + short_name: DfH + url_name: dfh + locale: he_IL + notes: An albatross told me!!! + publication_scheme: "" + disclosure_log: "" + |