Permalink
Browse files

Don't require initializer.rb in core.rb

  • Loading branch information...
Carl Lerche
Carl Lerche committed Dec 29, 2009
1 parent 49c800b commit 4ee70643b3c352a582069267ddb02186da8a86f7
@@ -15,7 +15,6 @@
require 'rails/core'
require 'rails/configuration'
require 'rails/deprecation'
-require 'rails/initializer'
require 'rails/ruby_version_check'
# For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
@@ -22,6 +22,8 @@
require 'action_controller'
require 'rails'
-Rails::Initializer.run do |config|
+# TODO: Remove these hacks
+class TestApp < Rails::Application
config.root = File.dirname(__FILE__)
end
+Rails.application = TestApp
@@ -1,27 +1,35 @@
require "isolation/abstract_unit"
module ApplicationTests
- class NotificationsTest < Test::Unit::TestCase
- include ActiveSupport::Testing::Isolation
+ class MyQueue
+ def publish(name, *args)
+ raise name
+ end
- class MyQueue
- def publish(name, *args)
- raise name
- end
+ # Not a full queue implementation
+ def method_missing(name, *args, &blk)
+ self
end
+ end
+
+ class NotificationsTest < Test::Unit::TestCase
+ include ActiveSupport::Testing::Isolation
def setup
build_app
boot_rails
- require "rails"
require "active_support/notifications"
@events = []
- Rails::Initializer.run do |c|
- c.notifications.notifier = ActiveSupport::Notifications::Notifier.new(MyQueue.new)
- end
+
+ add_to_config <<-RUBY
+ config.notifications.notifier = ActiveSupport::Notifications::Notifier.new(ApplicationTests::MyQueue.new)
+ RUBY
end
test "new queue is set" do
+ use_frameworks []
+ require "#{app_path}/config/environment"
+
assert_raise RuntimeError do
ActiveSupport::Notifications.publish('foo')
end
@@ -2,6 +2,8 @@
module PluginsTest
class FrameworkExtensionTest < Test::Unit::TestCase
+ include ActiveSupport::Testing::Isolation
+
def setup
build_app
boot_rails
@@ -23,12 +25,15 @@ class MyPlugin < Rails::Plugin
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
+
AppTemplate::Application.load_tasks
assert $ran_block
end
end
class ActiveRecordExtensionTest < Test::Unit::TestCase
+ include ActiveSupport::Testing::Isolation
+
def setup
build_app
boot_rails

0 comments on commit 4ee7064

Please sign in to comment.