diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-26 13:57:11 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-26 13:57:11 +0100 |
commit | 1dca7ebc93ebf067a73d23ddc33d97229a0b482f (patch) | |
tree | 6070c9418bf939427b7d1e7f1018dd0ec09ff1e3 /railties/test/application/initializers/i18n_test.rb | |
parent | e6da2f651ffc24e5be3842051df73493d158a6b4 (diff) | |
download | rails-1dca7ebc93ebf067a73d23ddc33d97229a0b482f.tar.gz rails-1dca7ebc93ebf067a73d23ddc33d97229a0b482f.tar.bz2 rails-1dca7ebc93ebf067a73d23ddc33d97229a0b482f.zip |
Refactor railties test, break huge files in smaller chunks and move initializers to application folder.
Diffstat (limited to 'railties/test/application/initializers/i18n_test.rb')
-rw-r--r-- | railties/test/application/initializers/i18n_test.rb | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/railties/test/application/initializers/i18n_test.rb b/railties/test/application/initializers/i18n_test.rb new file mode 100644 index 0000000000..99b2d86013 --- /dev/null +++ b/railties/test/application/initializers/i18n_test.rb @@ -0,0 +1,55 @@ +require "isolation/abstract_unit" + +module ApplicationTests + class I18nTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + boot_rails + FileUtils.rm_rf "#{app_path}/config/environments" + end + + # i18n + test "setting another default locale" do + add_to_config <<-RUBY + config.root = "#{app_path}" + config.i18n.default_locale = :de + RUBY + require "#{app_path}/config/environment" + + assert_equal :de, I18n.default_locale + end + + test "no config locales dir present should return empty load path" do + FileUtils.rm_rf "#{app_path}/config/locales" + add_to_config <<-RUBY + config.root = "#{app_path}" + RUBY + require "#{app_path}/config/environment" + + assert_equal [], Rails.application.config.i18n.load_path + end + + test "config locales dir present should be added to load path" do + add_to_config <<-RUBY + config.root = "#{app_path}" + RUBY + + require "#{app_path}/config/environment" + assert_equal ["#{app_path}/config/locales/en.yml"], Rails.application.config.i18n.load_path + end + + test "config defaults should be added with config settings" do + add_to_config <<-RUBY + config.root = "#{app_path}" + config.i18n.load_path << "my/other/locale.yml" + RUBY + require "#{app_path}/config/environment" + + assert_equal [ + "#{app_path}/config/locales/en.yml", "my/other/locale.yml" + ], Rails.application.config.i18n.load_path + end + end +end
\ No newline at end of file |