aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/initializer/initialize_i18n_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-10-10 17:15:11 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-10-10 17:15:11 +0100
commit66ee2654ff243f03595a402fa15e1eea1b5b45be (patch)
tree3f1055e03082f0c767719e8cba5155e4207779e0 /railties/test/initializer/initialize_i18n_test.rb
parentdd2779e1b83b4d867d47dd286ec0c919f5df12a9 (diff)
parentb9ce8216fa849a47ad0b0f99fa510e226a23c12e (diff)
downloadrails-66ee2654ff243f03595a402fa15e1eea1b5b45be.tar.gz
rails-66ee2654ff243f03595a402fa15e1eea1b5b45be.tar.bz2
rails-66ee2654ff243f03595a402fa15e1eea1b5b45be.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'railties/test/initializer/initialize_i18n_test.rb')
-rw-r--r--railties/test/initializer/initialize_i18n_test.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/railties/test/initializer/initialize_i18n_test.rb b/railties/test/initializer/initialize_i18n_test.rb
new file mode 100644
index 0000000000..e909688817
--- /dev/null
+++ b/railties/test/initializer/initialize_i18n_test.rb
@@ -0,0 +1,51 @@
+require "isolation/abstract_unit"
+
+module InitializerTests
+ class InitializeI18nTest < Test::Unit::TestCase
+ include ActiveSupport::Testing::Isolation
+
+ def setup
+ build_app
+ boot_rails
+ end
+
+ # test_config_defaults_and_settings_should_be_added_to_i18n_defaults
+ test "i18n config defaults and settings should be added to i18n defaults" do
+ Rails::Initializer.run do |c|
+ c.i18n.load_path << "my/other/locale.yml"
+ end
+
+ #{RAILS_FRAMEWORK_ROOT}/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml
+ assert_equal %W(
+ #{RAILS_FRAMEWORK_ROOT}/activesupport/lib/active_support/locale/en.yml
+ #{RAILS_FRAMEWORK_ROOT}/activemodel/lib/active_model/locale/en.yml
+ #{RAILS_FRAMEWORK_ROOT}/activerecord/lib/active_record/locale/en.yml
+ #{RAILS_FRAMEWORK_ROOT}/actionpack/lib/action_view/locale/en.yml
+ #{RAILS_FRAMEWORK_ROOT}/railties/tmp/app/config/locales/en.yml
+ my/other/locale.yml
+ ), I18n.load_path
+ end
+
+ test "i18n finds locale files in engines" do
+ app_file "vendor/plugins/engine/init.rb", ""
+ app_file "vendor/plugins/engine/app/models/hellos.rb", "class Hello ; end"
+ app_file "vendor/plugins/engine/lib/omg.rb", "puts 'omg'"
+ app_file "vendor/plugins/engine/config/locales/en.yml", "hello:"
+
+ Rails::Initializer.run do |c|
+ c.i18n.load_path << "my/other/locale.yml"
+ end
+
+ #{RAILS_FRAMEWORK_ROOT}/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml
+ assert_equal %W(
+ #{RAILS_FRAMEWORK_ROOT}/activesupport/lib/active_support/locale/en.yml
+ #{RAILS_FRAMEWORK_ROOT}/activemodel/lib/active_model/locale/en.yml
+ #{RAILS_FRAMEWORK_ROOT}/activerecord/lib/active_record/locale/en.yml
+ #{RAILS_FRAMEWORK_ROOT}/actionpack/lib/action_view/locale/en.yml
+ #{app_path}/config/locales/en.yml
+ my/other/locale.yml
+ #{app_path}/vendor/plugins/engine/config/locales/en.yml
+ ), I18n.load_path
+ end
+ end
+end \ No newline at end of file