提交 c8b88dd4 编写于 作者: Y yuuji.yaginuma

Use the single line editor in console test

It's a bit difficult to deal properly with IRB's multi line and color,
and I think we don't need to check it out in `rails console` tests.
上级 49d1b5a9
......@@ -137,14 +137,16 @@ def spawn_console(options, wait_for_prompt: true)
end
def test_sandbox
spawn_console("--sandbox")
options = "--sandbox"
options += " -- --singleline --nocolorize" if RUBY_VERSION >= "2.7"
spawn_console(options)
write_prompt "Post.count", "=> 0"
write_prompt "Post.create"
write_prompt "Post.count", "=> 1"
@primary.puts "quit"
spawn_console("--sandbox")
spawn_console(options)
write_prompt "Post.count", "=> 0"
write_prompt "Post.transaction { Post.create; raise }"
......@@ -164,7 +166,9 @@ def test_sandbox_when_sandbox_is_disabled
end
def test_environment_option_and_irb_option
spawn_console("-e test -- --verbose")
options = "-e test -- --verbose"
options += " --singleline --nocolorize" if RUBY_VERSION >= "2.7"
spawn_console(options)
write_prompt "a = 1", "a = 1"
write_prompt "puts Rails.env", "puts Rails.env\r\ntest"
......
......@@ -34,7 +34,9 @@ def test_console_command_work_inside_engine
skip "PTY unavailable" unless available_pty?
primary, replica = PTY.open
spawn_command("console", replica)
cmd = "console"
cmd += " --singleline" if RUBY_VERSION >= "2.7"
spawn_command(cmd, replica)
assert_output(">", primary)
ensure
primary.puts "quit"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册