diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-10-14 10:44:20 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-10-28 08:40:12 +0000 |
commit | 074fcf036ad91ae57f82adf5c93d143e3fadabb3 (patch) | |
tree | 265c97e79ff795d0dc857eab9afc0f5054f2017c /spec/integration/localisation_spec.rb | |
parent | 55e0b9f75160222d07773f38c8aa67aa9de1487e (diff) |
Use factories, not fixtures, in integration spec.
Removes the dependency on fixtures having been loaded.
Diffstat (limited to 'spec/integration/localisation_spec.rb')
-rw-r--r-- | spec/integration/localisation_spec.rb | 29 |
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 |