Skip to content
Permalink
Browse files
Remove deprecated support to old config.ru that use the application…
… class as argument of `run`
  • Loading branch information
rafaelfranca committed Jan 17, 2019
1 parent e20589c commit 553b86fc751c751db504bcbe2d033eb2bb5b6a0b
@@ -1,3 +1,7 @@
* Remove deprecated support to old `config.ru` that use the application class as argument of `run`.

*Rafael Mendonça França*

* Remove deprecated `environment` argument from the rails commands.

*Rafael Mendonça França*
@@ -21,19 +21,6 @@ def initialize(options = nil)
set_environment
end

def app
@app ||= begin
app = super
if app.is_a?(Class)
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Using `Rails::Application` subclass to start the server is deprecated and will be removed in Rails 6.0.
Please change `run #{app}` to `run Rails.application` in config.ru.
MSG
end
app.respond_to?(:to_app) ? app.to_app : app
end
end

def opt_parser
Options.new
end
@@ -18,20 +18,6 @@ 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: Using `Rails::Application` subclass to start the server is deprecated/, log)
end

test "restart rails server with custom pid file path" do
skip "PTY unavailable" unless available_pty?

0 comments on commit 553b86f

Please sign in to comment.