aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/integration/localisation_spec.rb9
-rw-r--r--spec/spec_helper.rb7
2 files changed, 5 insertions, 11 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
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index c7fb0af75..7e3df4f39 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -88,12 +88,9 @@ Spork.prefork do
# ApplicationController#set_gettext_locale which sets the locale and so you may be setting
# the locale in your tests and not even realising it. So, let's make things easier for
# ourselves and just always restore the locale for all tests.
- config.before(:each) do
- @save_i18n_locale = I18n.locale
- end
-
config.after(:each) do
- I18n.locale = @save_i18n_locale
+ AlaveteliLocalization.set_locales(AlaveteliConfiguration::available_locales,
+ AlaveteliConfiguration::default_locale)
end
# Turn routing-filter off in functional and unit tests as per