diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-07-18 17:10:31 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-07-18 17:43:26 +0100 |
commit | bc0a6d54c4e5f3673a761ca434c49cbfebb89b09 (patch) | |
tree | ac7165739b51316122040be55d8ed5561f440ddf /spec/integration/localisation_spec.rb | |
parent | 9fe48c5b9db1c0ba6c1a59f0d092c88e5cae1aa0 (diff) |
Extract code for setting locales in FastGettext and I18n
Diffstat (limited to 'spec/integration/localisation_spec.rb')
-rw-r--r-- | spec/integration/localisation_spec.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/spec/integration/localisation_spec.rb b/spec/integration/localisation_spec.rb index 140f9f785..64d39f0af 100644 --- a/spec/integration/localisation_spec.rb +++ b/spec/integration/localisation_spec.rb @@ -7,21 +7,19 @@ describe "when generating urls" do end it "should generate URLs that include the locale when using one that includes an underscore" do - AlaveteliConfiguration.stub!(:available_locales).and_return('en_GB') get('/en_GB') response.body.should match /href="\/en_GB\// end it "should fall back to the language if the territory is unknown" do - AlaveteliConfiguration.stub!(:available_locales).and_return('es en') - AlaveteliConfiguration.stub!(:default_locale).and_return('es') + AlaveteliLocalization.set_locales(available_locales='es en', default_locale='en') get('/', {}, {'HTTP_ACCEPT_LANGUAGE' => 'en_US'}) response.body.should match /href="\/en\// response.body.should_not match /href="\/en_US\// end it "should generate URLs without a locale prepended when there's only one locale set" do - AlaveteliConfiguration.stub!(:available_locales).and_return('en') + AlaveteliLocalization.set_locales(available_locales='en', default_locale='en') get('/') response.should_not contain @home_link_regex end @@ -39,8 +37,7 @@ describe "when generating urls" do describe 'when there is more than one locale' do before do - AlaveteliConfiguration.stub!(:available_locales).and_return('en es') - AlaveteliConfiguration.stub!(:default_locale).and_return('en') + AlaveteliLocalization.set_locales(available_locales='es en', default_locale='en') end it "should generate URLs with a locale prepended when there's more than one locale set" do |