1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ensure that Rails.application.initialize! is called only once

This commit is contained in:
Piotr Sarnacki 2010-07-22 12:07:45 +02:00
parent 153df92f9f
commit abeb0ff2cc
2 changed files with 7 additions and 0 deletions

View file

@ -95,7 +95,9 @@ module Rails
end
def initialize!
raise "Application has been already initialized." if @initialized
run_initializers(self)
@initialized = true
self
end

View file

@ -89,6 +89,11 @@ class LoadingTest < Test::Unit::TestCase
assert_equal [], ActiveRecord::Base.descendants
end
test "initialize_cant_be_called_twice" do
require "#{app_path}/config/environment"
assert_raise(RuntimeError) { ::AppTemplate::Application.initialize! }
end
protected
def setup_ar!