ruby-on-railstestingrubygemscoffeescriptjasmine

Jasminerice: spec failing because jQuery is not defined


I just installed the gem Jasminerice in a Ruby on Rails project. Following the instructions on Jasminerice GitHub, I created a spec, started the Ruby on Rails server, and navigated to the /jasmine route.

Although the spec was written to pass, it failed with:

ReferenceError: jQuery is not defined


Solution

  • In spec/javascripts/spec.js.coffee

    Simply add the line #= require jquery before #= require_tree ./