File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
lib/rails/commands/console Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,8 @@ def start
90
90
91
91
env = colorized_env
92
92
app_name = @app . class . module_parent_name . underscore . dasherize
93
- prompt_prefix = "#{ app_name } (#{ env } )"
93
+ prompt_prefix = "%N(#{ env } )"
94
+ IRB . conf [ :IRB_NAME ] = app_name
94
95
95
96
IRB . conf [ :PROMPT ] [ :RAILS_PROMPT ] = {
96
97
PROMPT_I : "#{ prompt_prefix } > " ,
Original file line number Diff line number Diff line change @@ -110,6 +110,22 @@ def test_sandbox_by_default_with_development_environment
110
110
@primary . puts "quit"
111
111
end
112
112
113
+ def test_prompt_is_properly_set
114
+ options = "-e test"
115
+ spawn_console ( options )
116
+
117
+ write_prompt "a = 1" , "a = 1" , prompt : "app-template(test)>"
118
+ end
119
+
120
+ def test_prompt_allows_changing_irb_name
121
+ options = "-e test"
122
+ spawn_console ( options )
123
+
124
+ write_prompt "conf.irb_name = 'foo'"
125
+ write_prompt "a = 1" , "a = 1" , prompt : "foo(test)>"
126
+ @primary . puts "quit"
127
+ end
128
+
113
129
def test_environment_option_and_irb_option
114
130
options = "-e test -- --verbose"
115
131
spawn_console ( options )
You can’t perform that action at this time.
0 commit comments