Skip to content

Commit

Permalink
Fix console_test to work with both IRB's RelineInputMethod and StdioI…
Browse files Browse the repository at this point in the history
…nputMethod
  • Loading branch information
tompng committed May 5, 2024
1 parent 2b14603 commit 4b46041
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions railties/test/application/console_test.rb
Expand Up @@ -25,11 +25,11 @@ def teardown
teardown_app
end

def write_prompt(command, expected_output = nil)
def write_prompt(command, expected_output = nil, prompt: "> ")
@primary.puts command
assert_output command, @primary
assert_output expected_output, @primary, 100 if expected_output
assert_output "> ", @primary
assert_output prompt, @primary
end

def spawn_console(options, wait_for_prompt: true, env: {})
Expand Down Expand Up @@ -123,21 +123,21 @@ def test_production_console_prompt
options = "-e production"
spawn_console(options)

write_prompt "123", "app-template(prod)> 123"
write_prompt "123", prompt: "app-template(prod)>"
end

def test_development_console_prompt
options = "-e development"
spawn_console(options)

write_prompt "123", "app-template(dev)> 123"
write_prompt "123", prompt: "app-template(dev)> "
end

def test_test_console_prompt
options = "-e test"
spawn_console(options)

write_prompt "123", "app-template(test)> 123"
write_prompt "123", prompt: "app-template(test)> "
end

def test_helper_helper_method
Expand Down Expand Up @@ -219,7 +219,7 @@ def test_console_respects_user_defined_prompt_mode
options = "-e test"
spawn_console(options, env: { "IRBRC" => irbrc.path })

write_prompt "123", ">> 123"
write_prompt "123", prompt: ">> "
ensure
File.unlink(irbrc)
end
Expand Down

0 comments on commit 4b46041

Please sign in to comment.