diff options
author | Xavier Noria <fxn@hashref.com> | 2016-02-17 00:58:43 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-02-17 00:59:42 +0100 |
commit | 94dbc48887bf39c241ee2ce1741ee680d773f202 (patch) | |
tree | c066eb7703e4eb3c14ea737f968e9552c75be329 /railties/test/generators | |
parent | 5971fddb7997231f3431c26ba17471ba52704852 (diff) | |
download | rails-94dbc48887bf39c241ee2ce1741ee680d773f202.tar.gz rails-94dbc48887bf39c241ee2ce1741ee680d773f202.tar.bz2 rails-94dbc48887bf39c241ee2ce1741ee680d773f202.zip |
adds --skip-listen to the application generator [closes #23590]
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index be05e779ea..921a5b36b5 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -479,18 +479,20 @@ class AppGeneratorTest < Rails::Generators::TestCase end end - def test_inclusion_of_listen_related_gems + def test_inclusion_of_listen_related_configuration_by_default run_generator if RbConfig::CONFIG['host_os'] =~ /darwin|linux/ - assert_gem 'listen' - assert_gem 'spring-watcher-listen' + assert_listen_related_configuration else - assert_file 'Gemfile' do |content| - assert_no_match(/listen/, content) - end + assert_no_listen_related_configuration end end + def test_non_inclusion_of_listen_related_configuration_if_skip_listen + run_generator [destination_root, '--skip-listen'] + assert_no_listen_related_configuration + end + def test_evented_file_update_checker_config run_generator assert_file 'config/environments/development.rb' do |content| @@ -759,4 +761,23 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file "Gemfile", /^\s*gem\s+["']#{gem}["']$*/ end end + + def assert_listen_related_configuration + assert_gem 'listen' + assert_gem 'spring-watcher-listen' + + assert_file 'config/environments/development.rb' do |content| + assert_match(/^\s*config.file_watcher = ActiveSupport::EventedFileUpdateChecker/, content) + end + end + + def assert_no_listen_related_configuration + assert_file 'Gemfile' do |content| + assert_no_match(/listen/, content) + end + + assert_file 'config/environments/development.rb' do |content| + assert_match(/^\s*# config.file_watcher = ActiveSupport::EventedFileUpdateChecker/, content) + end + end end |