ref: refs/heads/backgroud_patches_bnc550934
commit 65628fb836402a33a2abccdd9ac9c323bc2ad39d
Author: Josef Reidinger
Date: Thu Nov 26 15:01:26 2009 +0100
add testcase for language detection
---
webclient/test/functional/lang_controller_test.rb | 31 +++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/webclient/test/functional/lang_controller_test.rb b/webclient/test/functional/lang_controller_test.rb
new file mode 100644
index 0000000..db20922
--- /dev/null
+++ b/webclient/test/functional/lang_controller_test.rb
@@ -0,0 +1,31 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require 'mocha'
+
+class LangController < ApplicationController
+end
+
+class LangControllerTest < ActionController::TestCase
+ SUPPORTED_LANG = [ "en_US", "en_GB", "cs_CZ", "de_DE" ]
+
+ def setup
+ @controller = LangController.new
+ I18n.supported_locales= SUPPORTED_LANG
+ end
+
+ def test_known_lang
+ @controller.locale.stubs(:language).returns("cs_CZ")
+ assert_equal "cs_CZ",@controller.current_locale
+ end
+
+ def test_unsuported_lang
+ @controller.locale.stubs(:language).returns("pt_BR")
+ assert_equal "en_US",@controller.current_locale
+ end
+
+ def test_browser_lang
+ @controller.locale.stubs(:language).returns("en-gb")
+ assert_equal "en_GB",@controller.current_locale
+ end
+
+end
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org