diff options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/initializer_test.rb | 4 | ||||
-rw-r--r-- | railties/test/application/notifications_test.rb | 27 | ||||
-rw-r--r-- | railties/test/initializable_test.rb | 28 | ||||
-rw-r--r-- | railties/test/initializer/initialize_i18n_test.rb | 3 | ||||
-rw-r--r-- | railties/test/initializer/path_test.rb | 2 |
5 files changed, 16 insertions, 48 deletions
diff --git a/railties/test/application/initializer_test.rb b/railties/test/application/initializer_test.rb index 754c0f1839..205840360c 100644 --- a/railties/test/application/initializer_test.rb +++ b/railties/test/application/initializer_test.rb @@ -29,7 +29,7 @@ module ApplicationTests add_to_config <<-RUBY config.root = "#{app_path}" - config.eager_load_paths = "#{app_path}/lib" + config.eager_load_paths << "#{app_path}/lib" RUBY require "#{app_path}/config/environment" @@ -132,7 +132,7 @@ module ApplicationTests require "#{app_path}/config/environment" assert_equal [ - "#{app_path}/config/locales/en.yml", "my/other/locale.yml" + "my/other/locale.yml", "#{app_path}/config/locales/en.yml" ], Rails.application.config.i18n.load_path end diff --git a/railties/test/application/notifications_test.rb b/railties/test/application/notifications_test.rb index db8605edbe..061bb34c19 100644 --- a/railties/test/application/notifications_test.rb +++ b/railties/test/application/notifications_test.rb @@ -1,17 +1,6 @@ require "isolation/abstract_unit" module ApplicationTests - class MyQueue - def publish(name, *args) - raise name - end - - # Not a full queue implementation - def method_missing(name, *args, &blk) - self - end - end - class MockLogger def method_missing(*args) @logged ||= [] @@ -39,22 +28,6 @@ module ApplicationTests ActiveSupport::Notifications.notifier.wait end - test "new queue is set" do - # We don't want to load all frameworks, so remove them and clean up environments. - use_frameworks [] - FileUtils.rm_rf("#{app_path}/config/environments") - - add_to_config <<-RUBY - config.notifications.notifier = ActiveSupport::Notifications::Notifier.new(ApplicationTests::MyQueue.new) - RUBY - - require "#{app_path}/config/environment" - - assert_raise RuntimeError do - ActiveSupport::Notifications.publish('foo') - end - end - test "rails subscribers are added" do add_to_config <<-RUBY config.colorize_logging = false diff --git a/railties/test/initializable_test.rb b/railties/test/initializable_test.rb index e308cbcb0e..0c7378cb64 100644 --- a/railties/test/initializable_test.rb +++ b/railties/test/initializable_test.rb @@ -10,14 +10,14 @@ module InitializableTests attr_accessor :foo, :bar end - initializer :omg, :global => true do + initializer :omg do @foo ||= 0 @foo += 1 end end class Bar < Foo - initializer :bar, :global => true do + initializer :bar do @bar ||= 0 @bar += 1 end @@ -26,7 +26,7 @@ module InitializableTests module Word include Rails::Initializable - initializer :word, :global => true do + initializer :word do $word = "bird" end end @@ -34,11 +34,11 @@ module InitializableTests class Parent include Rails::Initializable - initializer :one, :global => true do + initializer :one do $arr << 1 end - initializer :two, :global => true do + initializer :two do $arr << 2 end end @@ -46,17 +46,17 @@ module InitializableTests class Child < Parent include Rails::Initializable - initializer :three, :before => :one, :global => true do + initializer :three, :before => :one do $arr << 3 end - initializer :four, :after => :one, :global => true do + initializer :four, :after => :one do $arr << 4 end end class Parent - initializer :five, :before => :one, :global => true do + initializer :five, :before => :one do $arr << 5 end end @@ -72,11 +72,11 @@ module InitializableTests $arr << 2 end - initializer :three, :global => true do + initializer :three do $arr << 3 end - initializer :four, :global => true do + initializer :four do $arr << 4 end end @@ -181,13 +181,7 @@ module InitializableTests $arr = [] instance = Instance.new instance.run_initializers - assert_equal [1, 2], $arr - end - - test "running globals" do - $arr = [] - Instance.run_initializers - assert_equal [3, 4], $arr + assert_equal [1, 2, 3, 4], $arr end end diff --git a/railties/test/initializer/initialize_i18n_test.rb b/railties/test/initializer/initialize_i18n_test.rb index 472566378d..904d2a6566 100644 --- a/railties/test/initializer/initialize_i18n_test.rb +++ b/railties/test/initializer/initialize_i18n_test.rb @@ -15,6 +15,7 @@ module InitializerTests config.root = "#{app_path}" config.i18n.load_path << "my/other/locale.yml" RUBY + require "#{app_path}/config/environment" #{RAILS_FRAMEWORK_ROOT}/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml @@ -23,8 +24,8 @@ module InitializerTests #{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 + #{RAILS_FRAMEWORK_ROOT}/railties/tmp/app/config/locales/en.yml ).map { |path| File.expand_path(path) }, I18n.load_path.map { |path| File.expand_path(path) } end diff --git a/railties/test/initializer/path_test.rb b/railties/test/initializer/path_test.rb index 76eb29bdf4..4f475fae11 100644 --- a/railties/test/initializer/path_test.rb +++ b/railties/test/initializer/path_test.rb @@ -45,7 +45,7 @@ module InitializerTests assert_path @paths.tmp, "tmp" assert_path @paths.tmp.cache, "tmp", "cache" assert_path @paths.config, "config" - assert_path @paths.config.locales, "config", "locales" + assert_path @paths.config.locales, "config", "locales", "en.yml" assert_path @paths.config.environment, "config", "environments", "development.rb" assert_equal root("app", "controllers"), @paths.app.controllers.to_a.first |