diff --git a/lib/konacha.rb b/lib/konacha.rb index 36e3eff..661b408 100644 --- a/lib/konacha.rb +++ b/lib/konacha.rb @@ -60,5 +60,20 @@ def spec_paths }.sort end end + + def precompiled_assets + %W(konacha.css + chai.js + mocha.js + konacha/parent.js + konacha/iframe.js + konacha/runner.js).concat(spec_paths).map do |path| + path.gsub(/\.js\.coffee$/, ".js").gsub(/\.coffee$/, ".js") + end + end + + def asset_precompiled?(logical_path) + precompiled_assets.include? logical_path + end end end diff --git a/lib/konacha/engine.rb b/lib/konacha/engine.rb index fa62724..5c6f977 100644 --- a/lib/konacha/engine.rb +++ b/lib/konacha/engine.rb @@ -56,7 +56,7 @@ def self.formatters ActiveSupport.on_load(:action_view) do default_checker = ActionView::Base.precompiled_asset_checker ActionView::Base.precompiled_asset_checker = -> logical_path do - default_checker[logical_path] || Rails.env.test? + default_checker[logical_path] || Konacha.asset_precompiled?(logical_path) end end end