This is my module declaration:

(angular.module 'services.date', []) .service '$date', () -> # stuff this

This is my injection code:

describe 'Service: dateService', () -> dateService = null beforeEach module 'services.date' beforeEach inject (_$date_) -> dateService = _$date_ describe 'Test', () -> it 'should test stuff', () -> (expect true).toBe true

If I run this code I get this error:

Firefox 37.0.0 (Ubuntu 0.0.0) Service: dateService Test should test stuff FAILED minErr/<@/home/pv/Sites/web/ngbp-coffee/vendor/angular/angular.js:68:12 loadModules/<@/home/pv/Sites/web/ngbp-coffee/vendor/angular/angular.js:4411:15 forEach@/home/pv/Sites/web/ngbp-coffee/vendor/angular/angular.js:336:11 loadModules@/home/pv/Sites/web/ngbp-coffee/vendor/angular/angular.js:4372:5 createInjector@/home/pv/Sites/web/ngbp-coffee/vendor/angular/angular.js:4297:11 workFn@/home/pv/Sites/web/ngbp-coffee/vendor/angular-mocks/angular-mocks.js:2172:44

Now here's the interesting part: If I comment out the injection code, the test passes:

describe 'Service: dateService', () -> # dateService = null # beforeEach module 'services.date' # beforeEach inject (_$date_) -> # dateService = _$date_ describe 'Test', () -> it 'should test stuff', () -> (expect true).toBe true

// after running

Firefox 37.0.0 (Ubuntu 0.0.0): Executed 1 of 1 SUCCESS (0.003 secs / 0.002 secs) Done, without errors.

What is it about how I'm injecting the service that's wrong? Please help.

UPDATE

It looks like the $injector service cannot recognize my other service. If I do

$injector.has '$date'

I get false

WTF am I doing wrong?????