diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2016-12-08 10:33:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-08 10:33:23 -0800 |
commit | 0d20530e5edfd7d00fbc2a38ef5f87eca6ccc924 (patch) | |
tree | 269d4489c7b7b256aad1ca353961718f946aec8f /railties/test | |
parent | 17b09f4fca976063187be6494e64430850c37632 (diff) | |
download | rails-0d20530e5edfd7d00fbc2a38ef5f87eca6ccc924.tar.gz rails-0d20530e5edfd7d00fbc2a38ef5f87eca6ccc924.tar.bz2 rails-0d20530e5edfd7d00fbc2a38ef5f87eca6ccc924.zip |
Make Yarn the default, drop default vendor/asset directories (#27300)
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/api_app_generator_test.rb | 1 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 35 |
2 files changed, 11 insertions, 25 deletions
diff --git a/railties/test/generators/api_app_generator_test.rb b/railties/test/generators/api_app_generator_test.rb index 7069a07bbe..dc2872e45e 100644 --- a/railties/test/generators/api_app_generator_test.rb +++ b/railties/test/generators/api_app_generator_test.rb @@ -108,7 +108,6 @@ class ApiAppGeneratorTest < Rails::Generators::TestCase config/initializers/assets.rb config/initializers/cookies_serializer.rb lib/assets - vendor/assets test/helpers tmp/cache/assets public/404.html diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 15a923676d..d7c9ae5266 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -43,9 +43,6 @@ DEFAULT_APP_FILES = %w( test/mailers test/integration vendor - vendor/assets - vendor/assets/stylesheets - vendor/assets/javascripts tmp tmp/cache tmp/cache/assets @@ -466,7 +463,6 @@ class AppGeneratorTest < Rails::Generators::TestCase run_generator [destination_root, "--skip-javascript"] assert_no_file "app/assets/javascripts" - assert_no_file "vendor/assets/javascripts" assert_file "app/views/layouts/application.html.erb" do |contents| assert_match(/stylesheet_link_tag\s+'application', media: 'all' %>/, contents) @@ -492,12 +488,21 @@ class AppGeneratorTest < Rails::Generators::TestCase end end - def test_generator_if_yarn_option_is_given - run_generator([destination_root, "--yarn"]) + def test_generator_for_yarn + run_generator([destination_root]) assert_file "vendor/package.json", /dependencies/ assert_file "config/initializers/assets.rb", /node_modules/ end + def test_generator_for_yarn_skipped + run_generator([destination_root]) + assert_no_file "vendor/package.json" + + assert_file "config/environments/production.rb" do |content| + assert_no_match(/node_modules/, content) + end + end + def test_inclusion_of_jbuilder run_generator assert_gem "jbuilder" @@ -618,10 +623,6 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_generates_with_bundler end - def test_generation_runs_yarn_install_with_yarn_option - assert_generates_with_yarn yarn: true - end - def test_dev_option assert_generates_with_bundler dev: true rails_path = File.expand_path("../../..", Rails.root) @@ -847,18 +848,4 @@ class AppGeneratorTest < Rails::Generators::TestCase quietly { generator.invoke_all } end end - - def assert_generates_with_yarn(options = {}) - generator([destination_root], options) - - command_check = -> command do - @install_called ||= 0 - @install_called += 1 - assert_equal 1, @install_called, "install expected to be called once, but was called #{@install_called} times" - end - - generator.stub :yarn_command, command_check do - quietly { generator.invoke_all } - end - end end |