aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration/localisation_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-10-28 08:43:51 +0000
committerLouise Crow <louise.crow@gmail.com>2014-10-28 08:43:51 +0000
commitf22131bce2513e7cd58bdf6f7fecc60eebcfd89d (patch)
treeae66bcc72ea261331bee042f0a0aa62e5a054bac /spec/integration/localisation_spec.rb
parent0c3bee857b1b6a0a114d319f8722d25ae59166bd (diff)
parent5bb459de4ba327e54c97c75bf4ea660cc909efd4 (diff)
Merge branch 'fix_transient_locale_integration_errors' into rails-3-develop
Diffstat (limited to 'spec/integration/localisation_spec.rb')
-rw-r--r--spec/integration/localisation_spec.rb29
1 files changed, 22 insertions, 7 deletions
diff --git a/spec/integration/localisation_spec.rb b/spec/integration/localisation_spec.rb
index 4f6b61ae1..037603ad5 100644
--- a/spec/integration/localisation_spec.rb
+++ b/spec/integration/localisation_spec.rb
@@ -24,14 +24,29 @@ describe "when generating urls" do
response.should_not contain @home_link_regex
end
- it 'should redirect requests for a public body in a locale to the canonical name in that locale' do
- get('/es/body/dfh')
- response.should redirect_to "/es/body/edfh"
- end
+ context 'when handling public body requests' do
+
+ before do
+ AlaveteliLocalization.set_locales(available_locales='es en', default_locale='en')
+ body = FactoryGirl.create(:public_body, :short_name => 'english_short')
+ I18n.with_locale(:es) do
+ body.short_name = 'spanish_short'
+ body.save!
+ end
+ end
+
+ it 'should redirect requests for a public body in a locale to the
+ canonical name in that locale' do
+ get('/es/body/english_short')
+ response.should redirect_to "/es/body/spanish_short"
+ end
- it 'should remember a filter view when redirecting a public body request to the canonical name' do
- get('/es/body/tgq/successful')
- response.should redirect_to "/es/body/etgq/successful"
+ it 'should remember a filter view when redirecting a public body
+ request to the canonical name' do
+ AlaveteliLocalization.set_locales(available_locales='es en', default_locale='en')
+ get('/es/body/english_short/successful')
+ response.should redirect_to "/es/body/spanish_short/successful"
+ end
end
describe 'when there is more than one locale' do