File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def self.method_added(_method_name)
13
13
end
14
14
15
15
def self . raise_deprecation_warning
16
- Rails . deprecator . warn ( <<~MSG , caller_locations ( 1 .. 1 ) )
16
+ Rails . deprecator . warn ( <<~MSG , caller_locations ( 2 .. 2 ) )
17
17
Extending Rails console through `Rails::ConsoleMethods` is deprecated and will be removed in Rails 7.3.
18
18
Please directly use IRB's extension API to add new commands or helpers to the console.
19
19
For more details, please visit: https://github.com/ruby/irb/blob/master/EXTEND_IRB.md
Original file line number Diff line number Diff line change @@ -215,7 +215,16 @@ def foo
215
215
216
216
spawn_console ( "-e development" , wait_for_prompt : false )
217
217
218
+ line_number = 0
219
+ app = File . readlines ( "#{ app_path } /config/application.rb" )
220
+ app . each_with_index do |line , index |
221
+ if line . include? ( "Rails::ConsoleMethods.include(MyConsole)" )
222
+ line_number = index + 1
223
+ end
224
+ end
225
+
218
226
assert_output "Extending Rails console through `Rails::ConsoleMethods` is deprecated" , @primary , 30
227
+ assert_output "(called from block in <class:Application> at #{ app_path } /config/application.rb:#{ line_number } )" , @primary , 30
219
228
write_prompt "foo" , "=> \" this is foo\" "
220
229
end
221
230
You can’t perform that action at this time.
0 commit comments