我有一套茉莉花规格,可以在某个时间为不再在我公司工作的人使用。我正在尝试跑步

rake jasmine


但是,当规格运行时,它们都会失败。我确定资产管道未加载,因为出现以下错误:

ReferenceError: jQuery is not defined


这是我的jasmine.yml

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

stylesheets:
  - 'app/assets/stylesheets/application.css'
  # - assets/application.css
  # - stylesheets/**/*.css

helpers:
  - 'helpers/**/*.js'

spec_files:
  - '**/*[sS]pec.js'

# src_dir
#
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
# Default: project root
#
# EXAMPLE:
#
# src_dir: public
#
# src_dir: app/assets

spec_dir: spec/javascripts


这是我的application.js

// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.tipTip
//= require jquery.endless-scroll
//= require jquery.groupedautocomplete
//= require jquery.waituntilexists
//= require jquery-ui-timepicker-addon
//= require vendor/jquery.tagsinput
//= require jquery.contextMenu
//= require moment
//= require application_init
//= require lib/behavior
//= require tooltip

//= require underscore
//= require backbone
//= require tent
//= require lib/backbone.store
//= require backbone_rails_sync
//= require backbone_datalink
//= require inflection
//= require haml
//= require jquery.toObject
//= require js2form
//= require form2js
//= require_tree ./backbone/models
//= require_tree ../templates
//= require ./lib/presenters/presenter
//= require table-fixed-header
//= require_tree .


有没有人有什么建议

最佳答案

这有点像在黑暗中拍摄,但是我在使用Ruby 2.0的Rails 3.2应用程序中遇到了同样的问题。显然,Sprockets无法解析js / css require语句存在问题:

https://github.com/sstephenson/sprockets/issues/352

08-07 18:03