aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-05-05 15:54:38 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-05-08 10:07:17 +0900
commitc776b6470875fd40885b181ff8467a2c2cc3ec70 (patch)
treee9df35761b69750428aa23f56beffe6fd2d49cd2 /railties/test
parent45095a817b29f3b4956abce5d059410d591b902a (diff)
downloadrails-c776b6470875fd40885b181ff8467a2c2cc3ec70.tar.gz
rails-c776b6470875fd40885b181ff8467a2c2cc3ec70.tar.bz2
rails-c776b6470875fd40885b181ff8467a2c2cc3ec70.zip
Allow irb options to be passed from `rails console` command
Fixes #28988
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/console_test.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/railties/test/application/console_test.rb b/railties/test/application/console_test.rb
index 72f340df34..057d473870 100644
--- a/railties/test/application/console_test.rb
+++ b/railties/test/application/console_test.rb
@@ -136,9 +136,9 @@ class FullStackConsoleTest < ActiveSupport::TestCase
assert_output "> "
end
- def spawn_console
+ def spawn_console(options)
Process.spawn(
- "#{app_path}/bin/rails console --sandbox",
+ "#{app_path}/bin/rails console #{options}",
in: @slave, out: @slave, err: @slave
)
@@ -146,18 +146,26 @@ class FullStackConsoleTest < ActiveSupport::TestCase
end
def test_sandbox
- spawn_console
+ spawn_console("--sandbox")
write_prompt "Post.count", "=> 0"
write_prompt "Post.create"
write_prompt "Post.count", "=> 1"
@master.puts "quit"
- spawn_console
+ spawn_console("--sandbox")
write_prompt "Post.count", "=> 0"
write_prompt "Post.transaction { Post.create; raise }"
write_prompt "Post.count", "=> 0"
@master.puts "quit"
end
+
+ def test_environment_option_and_irb_option
+ spawn_console("test -- --verbose")
+
+ write_prompt "a = 1", "a = 1"
+ write_prompt "puts Rails.env", "puts Rails.env\r\ntest"
+ @master.puts "quit"
+ end
end