adopted-ember-addons / ember-moment

MIT License
399 stars 122 forks source link

Assertion Failed: Cannot call get with 'locale' on an undefined object #218

Closed renpinto closed 7 years ago

renpinto commented 7 years ago

I am on ember 2.10.0 & ember-moment 7.0.1. This is how I have used it in the template, {{moment-format '27/11/2014' 'MM/DD/YYYY' 'DD/MM/YYYY'}}

I get the following error when I try to run a unit test, Assertion Failed: Cannot call get with 'locale' on an undefined object.

This was working fine with ember-moment 6.1.0.

screen shot 2017-01-10 at 07 18 12
jasonmit commented 7 years ago

Is this failing in your test specifically or is the moment-format helper also throwing in your app code?

I think you likely need to needs the service.

moduleFor('controller:x-foo', 'X-Foo Controller', {
  needs: ['service:moment']
});

If this doesn't fix it, please post your test or create a test which can reproduce this.

renpinto commented 7 years ago

It was just the test that was failing. Adding ['service:moment'] to needs solved my issue. Thanks for your help...