This is my module declaration:
(angular.module 'services.date', [])
.service '$date', () ->
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 is the interesting part: if I comment on the injection code, the test passes:
describe 'Service: dateService', () ->
describe 'Test', () ->
it 'should test stuff', () ->
(expect true).toBe true
// after launch
Firefox 37.0.0 (Ubuntu 0.0.0): Executed 1 of 1 SUCCESS (0.003 secs / 0.002 secs)
Done, without errors.
What happens with the way I introduced the wrong service? Please, help.
UPDATE
It seems that the service $injectorcannot recognize my other service. If i do
$injector.has '$date'
I get false
WTF am I doing wrong ?????