mirror of https://github.com/rails/rails
Merge pull request #51732 from Shopify/fix-rails-console-prompt
Avoid setting fixed app name in console prompt
This commit is contained in:
commit
5e3611ea5a
|
@ -90,7 +90,8 @@ module Rails
|
|||
|
||||
env = colorized_env
|
||||
app_name = @app.class.module_parent_name.underscore.dasherize
|
||||
prompt_prefix = "#{app_name}(#{env})"
|
||||
prompt_prefix = "%N(#{env})"
|
||||
IRB.conf[:IRB_NAME] = app_name
|
||||
|
||||
IRB.conf[:PROMPT][:RAILS_PROMPT] = {
|
||||
PROMPT_I: "#{prompt_prefix}> ",
|
||||
|
|
|
@ -110,6 +110,22 @@ class FullStackConsoleTest < ActiveSupport::TestCase
|
|||
@primary.puts "quit"
|
||||
end
|
||||
|
||||
def test_prompt_is_properly_set
|
||||
options = "-e test"
|
||||
spawn_console(options)
|
||||
|
||||
write_prompt "a = 1", "a = 1", prompt: "app-template(test)>"
|
||||
end
|
||||
|
||||
def test_prompt_allows_changing_irb_name
|
||||
options = "-e test"
|
||||
spawn_console(options)
|
||||
|
||||
write_prompt "conf.irb_name = 'foo'"
|
||||
write_prompt "a = 1", "a = 1", prompt: "foo(test)>"
|
||||
@primary.puts "quit"
|
||||
end
|
||||
|
||||
def test_environment_option_and_irb_option
|
||||
options = "-e test -- --verbose"
|
||||
spawn_console(options)
|
||||
|
|
Loading…
Reference in New Issue