chrizbot
unread,Apr 29, 2011, 3:39:26 PM4/29/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jasmine
Hi everyone.
I am brand new to Jasmine and want to get it testing a Backbone.js
application I just put together that runs on a Rails 2.x server.
After doing the install (via bundler) and starting the Jasmine server,
I am getting an error for a very simple test. The application runs
fine when in the normal environment.
Here is the test:
describe('Resource model', function() {
describe('when instantiated', function() {
it('should exhibit attributes', function() {
var resource = new Resource({
name: '1'
});
expect(resource.get('name'))
.toEqual('1');
});
});
});
Here are all of the errors I am getting in the console when running
this test:
Uncaught ReferenceError: jQuery is not defined
backbone.js:128Uncaught TypeError: Cannot call method 'extend' of
undefined
XXXXXX.js:1Uncaught TypeError: Cannot call method 'extend' of
undefined
XXXXXX.js:1Uncaught TypeError: Object function (attributes, options) {
attributes || (attributes = {});
if (this.defaults) attributes = _.extend({}, this.defaults,
attributes);
this.attributes = {};
this._escapedAttributes = {};
this.cid = _.uniqueId('c');
this.set(attributes, {silent : true});
this._previousAttributes = _.clone(this.attributes);
if (options && options.collection) this.collection =
options.collection;
this.initialize(attributes, options);
} has no method 'extend'
XXXXXXX.js:1Uncaught TypeError: Object function (attributes, options)
{
attributes || (attributes = {});
if (this.defaults) attributes = _.extend({}, this.defaults,
attributes);
this.attributes = {};
this._escapedAttributes = {};
this.cid = _.uniqueId('c');
this.set(attributes, {silent : true});
this._previousAttributes = _.clone(this.attributes);
if (options && options.collection) this.collection =
options.collection;
this.initialize(attributes, options);
} has no method 'extend'
XXXXXX.js:1Uncaught TypeError: Object function (attributes, options) {
attributes || (attributes = {});
if (this.defaults) attributes = _.extend({}, this.defaults,
attributes);
this.attributes = {};
this._escapedAttributes = {};
this.cid = _.uniqueId('c');
this.set(attributes, {silent : true});
this._previousAttributes = _.clone(this.attributes);
if (options && options.collection) this.collection =
options.collection;
this.initialize(attributes, options);
} has no method 'extend'
XXXXXXX.js:1Uncaught TypeError: Object function (attributes, options)
{
attributes || (attributes = {});
if (this.defaults) attributes = _.extend({}, this.defaults,
attributes);
this.attributes = {};
this._escapedAttributes = {};
this.cid = _.uniqueId('c');
this.set(attributes, {silent : true});
this._previousAttributes = _.clone(this.attributes);
if (options && options.collection) this.collection =
options.collection;
this.initialize(attributes, options);
} has no method 'extend'
XXXXX.js:1Uncaught TypeError: Cannot call method 'extend' of undefined
XXXXXX.js:1Uncaught TypeError: Cannot call method 'extend' of
undefined
XXXXX.js:1Uncaught TypeError: Cannot call method 'extend' of undefined
XXXXX.js:1Uncaught TypeError: Cannot call method 'extend' of undefined
jquery-ui.min.js:10Uncaught ReferenceError: jQuery is not defined
jquery.flot.js:28Uncaught ReferenceError: jQuery is not defined
prototype.js:4071Uncaught TypeError: Object [object Object] has no
method 'dispatchEvent'
When I view source for the Jasmine page being run all of the needed
JavaScript files from the project are being included.
I even tried to specifically add the jquery.min.js and backbone.js
files to the top of the jasmine.yml src_files in case there was some
JavaScript ordering issue.
Is there something really simple/stupid I am missing here?
Any help is appreciated. Thanks!