diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2015-09-27 17:34:13 -0400 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2015-09-29 11:56:58 -0700 |
commit | 20ec1e922cc141364881b17e2509c4d7dccca695 (patch) | |
tree | 9bb87a716930bf6b056c8775928b89367647a6ea /railties/test/isolation | |
parent | eb73c58003f4e71317800d5dd44d05af991351a3 (diff) | |
download | rails-20ec1e922cc141364881b17e2509c4d7dccca695.tar.gz rails-20ec1e922cc141364881b17e2509c4d7dccca695.tar.bz2 rails-20ec1e922cc141364881b17e2509c4d7dccca695.zip |
Eliminate overlapping `app/assets` load path
* Move `app/assets/manifest.js` to `app/assets/config/manifest.js`.
Avoid the suggestion that you can/should deep-link `stylesheets/foo`.
* Pull in all toplevel stylesheets and JavaScripts, not just
`application.js` and `.css`. Demonstrate how to use `link_directory`
with a specified `.js`/`.css` type.
* Fix RAILS_ENV handling in assets tests.
* Shush warnings spam from third-party libs that distract from tests.
Diffstat (limited to 'railties/test/isolation')
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 41d36680e0..73b0c417cb 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -51,7 +51,12 @@ module TestHelpers old_env = ENV["RAILS_ENV"] @app ||= begin ENV["RAILS_ENV"] = env - require "#{app_path}/config/environment" + + # FIXME: shush Sass warning spam, not relevant to testing Railties + Kernel.silence_warnings do + require "#{app_path}/config/environment" + end + Rails.application end ensure @@ -161,18 +166,18 @@ module TestHelpers require "action_view/railtie" require 'action_dispatch/middleware/flash' - app = Class.new(Rails::Application) - app.config.eager_load = false - app.secrets.secret_key_base = "3b7cd727ee24e8444053437c36cc66c4" - app.config.session_store :cookie_store, key: "_myapp_session" - app.config.active_support.deprecation = :log - app.config.active_support.test_order = :random - app.config.log_level = :info + @app = Class.new(Rails::Application) + @app.config.eager_load = false + @app.secrets.secret_key_base = "3b7cd727ee24e8444053437c36cc66c4" + @app.config.session_store :cookie_store, key: "_myapp_session" + @app.config.active_support.deprecation = :log + @app.config.active_support.test_order = :random + @app.config.log_level = :info - yield app if block_given? - app.initialize! + yield @app if block_given? + @app.initialize! - app.routes.draw do + @app.routes.draw do get "/" => "omg#index" end @@ -297,7 +302,10 @@ module TestHelpers end def boot_rails - require File.expand_path('../../../../load_paths', __FILE__) + # FIXME: shush Sass warning spam, not relevant to testing Railties + Kernel.silence_warnings do + require File.expand_path('../../../../load_paths', __FILE__) + end end end end @@ -327,5 +335,9 @@ Module.new do File.open("#{app_template_path}/config/boot.rb", 'w') do |f| f.puts "require '#{environment}'" f.puts "require 'rails/all'" + + # Preempt the Bundler.require in config/application.rb and silence warning + # spam from our gem dependencies (👋 hello Sass 😁) + f.puts "Kernel.silence_warnings { Bundler.require(*Rails.groups) }" end end unless defined?(RAILS_ISOLATED_ENGINE) |