From 838b40da8409ac08d37b8c04c2880a5bd6e1db98 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sat, 16 Dec 2017 20:02:25 +0900 Subject: Add `skip_bootsnap` option `bootsnap` is a useful gem normally. However, `bootsnap` is unnecessary when generating a Rails application to be used only for testing. So I want to control whether use this or not by option. --- railties/test/generators/app_generator_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 96803db838..9fc63755ae 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -792,6 +792,26 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_bootsnap + run_generator + + assert_gem "bootsnap" + assert_file "config/boot.rb" do |content| + assert_match(/require 'bootsnap\/setup'/, content) + end + end + + def test_skip_bootsnap + run_generator [destination_root, "--skip-bootsnap"] + + assert_file "Gemfile" do |content| + assert_no_match(/bootsnap/, content) + end + assert_file "config/boot.rb" do |content| + assert_no_match(/require 'bootsnap\/setup'/, content) + end + end + def test_inclusion_of_ruby_version run_generator -- cgit v1.2.3