File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
lib/rails/commands/console Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,8 @@ def start
87
87
88
88
env = colorized_env
89
89
prompt_prefix = "%N(#{ env } )"
90
- IRB . conf [ :IRB_NAME ] = @app . name
90
+ # Respect user's configured irb name.
91
+ IRB . conf [ :IRB_NAME ] = @app . name if IRB . conf [ :IRB_NAME ] == "irb"
91
92
92
93
IRB . conf [ :PROMPT ] [ :RAILS_PROMPT ] = {
93
94
PROMPT_I : "#{ prompt_prefix } :%03n> " ,
Original file line number Diff line number Diff line change @@ -242,6 +242,21 @@ class User
242
242
write_prompt "User.new.respond_to?(:age)" , "=> true"
243
243
end
244
244
245
+ def test_console_respects_user_defined_irb_name
246
+ irbrc = Tempfile . new ( "irbrc" )
247
+ irbrc . write <<-RUBY
248
+ IRB.conf[:IRB_NAME] = "jarretts-irb"
249
+ RUBY
250
+ irbrc . close
251
+
252
+ options = "-e test"
253
+ spawn_console ( options , env : { "IRBRC" => irbrc . path } )
254
+
255
+ write_prompt "123" , prompt : "jarretts-irb(test):002> "
256
+ ensure
257
+ File . unlink ( irbrc )
258
+ end
259
+
245
260
def test_console_respects_user_defined_prompt_mode
246
261
irbrc = Tempfile . new ( "irbrc" )
247
262
irbrc . write <<-RUBY
You can’t perform that action at this time.
0 commit comments