From e5fc096bea4e56a9eb17a80f12775b92c8a8f1ee Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 8 Mar 2013 15:10:00 +0000 Subject: The console --sandbox transaction should not be joinable Thanks @neerajdotname for noticing this bug. --- railties/test/application/console_test.rb | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'railties/test') diff --git a/railties/test/application/console_test.rb b/railties/test/application/console_test.rb index 588682d3d4..592bd73924 100644 --- a/railties/test/application/console_test.rb +++ b/railties/test/application/console_test.rb @@ -119,9 +119,11 @@ class FullStackConsoleTest < ActiveSupport::TestCase assert output.include?(expected), "#{expected.inspect} expected, but got:\n\n#{output}" end - def write_prompt(command) + def write_prompt(command, expected_output = nil) @master.puts command assert_output command + assert_output expected_output if expected_output + assert_output "> " end def kill(pid) @@ -143,21 +145,17 @@ class FullStackConsoleTest < ActiveSupport::TestCase def test_sandbox pid = spawn_console - write_prompt "Post.count" - assert_output "=> 0" - + write_prompt "Post.count", "=> 0" write_prompt "Post.create" - assert_output "=> " - - write_prompt "Post.count" - assert_output "=> 1" + write_prompt "Post.count", "=> 1" kill pid pid = spawn_console - write_prompt "Post.count" - assert_output "=> 0" + write_prompt "Post.count", "=> 0" + write_prompt "Post.transaction { Post.create; raise }" + write_prompt "Post.count", "=> 0" ensure kill pid end -- cgit v1.2.3