Skip to content

Commit

Permalink
Add Konacha Assets Checker
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkravets committed Feb 2, 2016
1 parent 5407404 commit f049dcf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/konacha.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/konacha/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f049dcf

Please sign in to comment.