forked from rails/rails
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate support of older
config.ru
Since Rails 4.0, `config.ru` generated by default uses instances of `Rails.application`. Therefore, I think that it is good to deprecate the old behavior. Related: rails#9669
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require "isolation/abstract_unit" | ||
require "rails/command" | ||
require "rails/commands/server/server_command" | ||
|
||
module ApplicationTests | ||
class ServerTest < ActiveSupport::TestCase | ||
include ActiveSupport::Testing::Isolation | ||
|
||
def setup | ||
build_app | ||
end | ||
|
||
def teardown | ||
teardown_app | ||
end | ||
|
||
test "deprecate support of older `config.ru`" do | ||
remove_file "config.ru" | ||
app_file "config.ru", <<-RUBY | ||
require_relative 'config/environment' | ||
run AppTemplate::Application | ||
RUBY | ||
|
||
server = Rails::Server.new(config: "#{app_path}/config.ru") | ||
server.app | ||
|
||
log = File.read(Rails.application.config.paths["log"].first) | ||
assert_match(/DEPRECATION WARNING: Use `Rails::Application` subclass to start the server is deprecated/, log) | ||
end | ||
end | ||
end |