Hi Garry,

Thanks for your help.

I added the basicService example to my project just for sanity check and it
worked.

However, I'm using a decorated $log. That is, I need not only to inject
$log, but also augment its methods.

For instance, I have a getInstance function on $log, which I'm injecting on
my tests using the code below.

beforeEach(function() {
         module('esxUiApp.services.VimApi', function($provide) {
            var MockLog = {
               getInstance: jasmine.createSpy('getInstance')
            };
            $provide.value('$log', MockLog);
         });
      });

And as you can imagine, tests fail when it finds any other native method on
$log, such as debug().

I also thought about mocking the whole $log object, but I'd like to see the
logs in my test output.

Any ideas?

Cheers,
George



Best,
George Maggessy

On Sat, Jan 17, 2015 at 10:49 AM, Garry Taylor <[email protected]> wrote:

> Hope this help?
>
>
> http://stackoverflow.com/questions/21119013/inject-log-service-on-simple-jasmine-test
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/BOnr3jDD63g/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to