Skip to content

Instantly share code, notes, and snippets.

@juliepagano
Created January 3, 2012 21:38
Show Gist options
  • Save juliepagano/1557071 to your computer and use it in GitHub Desktop.
Save juliepagano/1557071 to your computer and use it in GitHub Desktop.
Jasmine & Rails 3.1 asset pipeline don't play well together; a workaround
task :copy_jquery_files do
# Jasmine doesn't work with the asset pipeline; therefore we copy the jquery
# files manually.
spec = Gem::Specification.find_by_name("jquery-rails")
jquery_dir = Pathname.new(Gem.dir) +
"gems" +
"#{spec.name}-#{spec.version}" +
"vendor" +
"assets" +
"javascripts"
jquery_file = jquery_dir + "jquery.min.js"
jquery_ui_file = jquery_dir + "jquery-ui.min.js"
destination_dir = Pathname.new(Rails.root) + "spec" + "javascripts" + "tmp_helpers"
rm_rf destination_dir
mkdir destination_dir
cp jquery_file, destination_dir
cp jquery_ui_file, destination_dir
end
task :"jasmine:require" => [:copy_jquery_files]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment