mirror of https://github.com/rails/rails
Merge pull request #52040 from zzak/re-52026
Rails::ConsoleMethods deprecation warning should point to the source
This commit is contained in:
commit
5cb2603d56
|
@ -13,7 +13,7 @@ module Rails
|
|||
end
|
||||
|
||||
def self.raise_deprecation_warning
|
||||
Rails.deprecator.warn(<<~MSG, caller_locations(1..1))
|
||||
Rails.deprecator.warn(<<~MSG, caller_locations(2..2))
|
||||
Extending Rails console through `Rails::ConsoleMethods` is deprecated and will be removed in Rails 7.3.
|
||||
Please directly use IRB's extension API to add new commands or helpers to the console.
|
||||
For more details, please visit: https://github.com/ruby/irb/blob/master/EXTEND_IRB.md
|
||||
|
|
|
@ -215,7 +215,16 @@ class FullStackConsoleTest < ActiveSupport::TestCase
|
|||
|
||||
spawn_console("-e development", wait_for_prompt: false)
|
||||
|
||||
line_number = 0
|
||||
app = File.readlines("#{app_path}/config/application.rb")
|
||||
app.each_with_index do |line, index|
|
||||
if line.include?("Rails::ConsoleMethods.include(MyConsole)")
|
||||
line_number = index + 1
|
||||
end
|
||||
end
|
||||
|
||||
assert_output "Extending Rails console through `Rails::ConsoleMethods` is deprecated", @primary, 30
|
||||
assert_output "(called from block in <class:Application> at #{app_path}/config/application.rb:#{line_number})", @primary, 30
|
||||
write_prompt "foo", "=> \"this is foo\""
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue