Jasmine won't load javascript files from asset pipeline

你。 提交于 2019-12-06 23:53:43

问题


I'm developing a gem and I've installed Jasmine https://github.com/pivotal/jasmine-gem/

All of my required JS files are in my manifest file at app/assets/javascripts/application.js

//= require underscore
//= require backbone

//= require_tree .//vendor
//= require_tree .//custom

//= require_tree .//templates
//= require_tree .//models
//= require_tree .//collections
//= require_tree .//views

And my jasmine.yml file references that:

src_files:
  - 'app/assets/javascripts/application.js'

But none of the files specified in it load. Anyone know why? I'm using the latest, Jasmine 1.3.2, which is supposed to support the asset pipeline so that you don't need to use something like jasmine-rails. Any thoughts?


回答1:


In your jasmine.yml the path should be 'assets/application.js'. If you're still having trouble, make sure you have your jasmine gem under both development and test groups in your Gemfile, as specified in the instructions on https://github.com/pivotal/jasmine-gem:

group :development, :test do
  gem 'jasmine'
end



回答2:


If you are using Rails 4 there is bug in version 1.3.2 where is it checking config.assets.enabled which no longer is defined in Rails 4.

The following worked for me. gem 'jasmine', "~> 2.0.0.rc4"

This is the ticket that talks about the issue. https://github.com/pivotal/jasmine-gem/pull/177



来源:https://stackoverflow.com/questions/15394914/jasmine-wont-load-javascript-files-from-asset-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!