summaryrefslogtreecommitdiff
path: root/test/integration/locale_path_test.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-07-14 14:54:27 -0700
committerelijah <elijah@riseup.net>2015-07-14 14:54:27 -0700
commit8986b2ffdec389b59df4cb9eb48f2f0a0220b462 (patch)
treebbafabf606929a8b6eff1d4b3ed17d48b65cee5b /test/integration/locale_path_test.rb
parentb08d4871dfa77f6fd41a53b51377033d96f47332 (diff)
fix i18n tests
Diffstat (limited to 'test/integration/locale_path_test.rb')
-rw-r--r--test/integration/locale_path_test.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/integration/locale_path_test.rb b/test/integration/locale_path_test.rb
index 2c43ab2..738e7f5 100644
--- a/test/integration/locale_path_test.rb
+++ b/test/integration/locale_path_test.rb
@@ -24,28 +24,35 @@ class LocalePathTest < ActionDispatch::IntegrationTest
test "redirect if accept-language is not default locale" do
get_via_redirect '/', {}, 'HTTP_ACCEPT_LANGUAGE' => 'de'
assert_equal '/de', path
- assert_equal({:locale => :de}, @controller.default_url_options)
+ assert_equal({:locale => :de}, default_url_options)
end
test "no locale prefix" do
get_via_redirect '/', {}, 'HTTP_ACCEPT_LANGUAGE' => 'en'
assert_equal '/', path
- assert_equal({:locale => nil}, @controller.default_url_options)
+ assert_equal({:locale => nil}, default_url_options)
get_via_redirect '/', {}, 'HTTP_ACCEPT_LANGUAGE' => 'pt'
assert_equal '/', path
- assert_equal({:locale => nil}, @controller.default_url_options)
+ assert_equal({:locale => nil}, default_url_options)
end
test "no redirect if locale explicit" do
get_via_redirect '/de', {}, 'HTTP_ACCEPT_LANGUAGE' => 'en'
assert_equal '/de', path
- assert_equal({:locale => :de}, @controller.default_url_options)
+ assert_equal({:locale => :de}, default_url_options)
end
test "strip prefix from url options if locale is default" do
get_via_redirect '/en', {}, 'HTTP_ACCEPT_LANGUAGE' => 'en'
assert_equal '/en', path
- assert_equal({:locale => nil}, @controller.default_url_options)
+ assert_equal({:locale => nil}, default_url_options)
end
+
+ protected
+
+ def default_url_options
+ @controller.send(:default_url_options)
+ end
+
end \ No newline at end of file