mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Ensure that Rails.application.initialize! is called only once
This commit is contained in:
@@ -95,7 +95,9 @@ module Rails
|
||||
end
|
||||
|
||||
def initialize!
|
||||
raise "Application has been already initialized." if @initialized
|
||||
run_initializers(self)
|
||||
@initialized = true
|
||||
self
|
||||
end
|
||||
|
||||
|
||||
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user