Skip to content

Instantly share code, notes, and snippets.

@cymen
Forked from th3hunt/teaspoon.rb
Last active October 31, 2015 00:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cymen/7ab440c692adc9197ce3 to your computer and use it in GitHub Desktop.
Save cymen/7ab440c692adc9197ce3 to your computer and use it in GitHub Desktop.
<%
# Build the helper file
# assumes config.assets.paths << Rails.root.join('tmp', 'teaspoon', 'assets') in development.rb
tmp_assets = Rails.root.join("tmp/teaspoon/assets")
spec_helper = File.join(tmp_assets, "spec_helper.js")
FileUtils.mkdir_p(File.dirname(spec_helper)) unless File.directory?(File.dirname(spec_helper))
specs = @suite.spec_assets(false).map{ |s| "#{s.gsub(/\.js.*$/, "")}" }
File.open(spec_helper, 'w') do |f|
specs.each { |spec| f.puts "require('../../../spec/javascripts/#{spec}');" }
end
%>
<%= javascript_include_tag "spec_helper" %>
<script>
Teaspoon.onWindowLoad(Teaspoon.execute);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment