diff options
author | Yuji Yaginuma <yuuji.yaginuma@gmail.com> | 2017-12-26 08:23:33 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-26 08:23:33 +0900 |
commit | 4943c7ed11ecb9c0ae2df369faecadead08f886b (patch) | |
tree | 518f96a2eda9905933a3543e995729a08975cce0 /railties/test/generators | |
parent | 9596d78a12ddac7ade8659cf2843aaeb44cc58d6 (diff) | |
download | rails-4943c7ed11ecb9c0ae2df369faecadead08f886b.tar.gz rails-4943c7ed11ecb9c0ae2df369faecadead08f886b.tar.bz2 rails-4943c7ed11ecb9c0ae2df369faecadead08f886b.zip |
Prevent to install gems when run test (#31564)
`invoke_all` cause `bundle install`. This will install gems actually
defined in `Gemfile`. To avoid this, stubbed `bundle_command`.
Fixes #31557
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 12 | ||||
-rw-r--r-- | railties/test/generators/shared_generator_tests.rb | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 793cce2999..fcb515c606 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -324,7 +324,9 @@ class AppGeneratorTest < Rails::Generators::TestCase end generator.stub :rails_command, command_check do - quietly { generator.invoke_all } + generator.stub :bundle_command, nil do + quietly { generator.invoke_all } + end end end @@ -762,7 +764,9 @@ class AppGeneratorTest < Rails::Generators::TestCase end generator([destination_root], webpack: "webpack").stub(:rails_command, command_check) do - quietly { generator.invoke_all } + generator.stub :bundle_command, nil do + quietly { generator.invoke_all } + end end assert_gem "webpacker" @@ -783,7 +787,9 @@ class AppGeneratorTest < Rails::Generators::TestCase end generator([destination_root], webpack: "react").stub(:rails_command, command_check) do - quietly { generator.invoke_all } + generator.stub :bundle_command, nil do + quietly { generator.invoke_all } + end end end diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index 7a746f5b62..29528825b8 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -92,7 +92,9 @@ module SharedGeneratorTests end generator([destination_root], template: path).stub(:open, check_open, template) do - quietly { assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) } + generator.stub :bundle_command, nil do + quietly { assert_match(/It works!/, capture(:stdout) { generator.invoke_all }) } + end end end |