I am trying to unit test an Angular service with a Jasmine spec file. This requires that a module be loaded. Here is a simple spec designed in an attempt to simply load the Angular module:
describe('Submission services', function () {
it('Finds angular', function () {
module('submissionServices');
});
});
When I run Jasmine, this results in the following error
Running Jasmine specs...
FAIL: 1 test, 1 failure, 0.004 secs.
Submission services Finds angular. (/Users/XXX/Projects/globe_town/spec/javascripts/SubmissionsSpec.js:3)
ReferenceError: Can't find variable: module
Test ordering seed: --seed 1826
rake aborted!
Jasmine::Headless::TestFailure
The jasmine.yml file contains
src_files:
- public/javascripts/jquery.js
- spec/javascripts/lib/angular/angular.js
- spec/javascripts/lib/angular/angular-resource.js
- app/assets/javascripts/services/submissions.js
stylesheets:
- stylesheets/**/*.css
helpers:
- helpers/**/*.js
spec_files:
- '**/*[sS]pec.js'
src_dir:
spec_dir: spec/javascripts
The versions of the software are:
What do I need to do to make Jasmine find Angular?
Make sure you include http://code.angularjs.org/1.1.0/angular-mocks.js for the angular-jasmine-helper functions like module
.