我正在尝试使用 Jasmine 规范文件对 Angular 服务进行单元测试。这需要加载一个模块。这是一个简单的规范,旨在简单地加载 Angular 模块:
describe('Submission services', function () {
it('Finds angular', function () {
module('submissionServices');
});
});
当我运行 Jasmine 时,这会导致以下错误
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
jasmine.yml 文件包含
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
软件版本如下:
- 导轨 3.2.7
- 茉莉花核 1.2.0
- 茉莉花无头webkit 0.8.4
- AngularJS 1.0.2
我需要做什么才能让 Jasmine 找到 Angular?