我试图用Jasmine spec文件单元测试一个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
软件的版本是:
> Rails 3.2.7
>茉莉核心1.2.0
> jasmine-headless-webkit 0.8.4
> AngularJS 1.0.2
我需要做什么来使Jasmine找到Angular?