title: How do I test an AngularJS service with Jasmine?
body: <p>(There is a related question here: <a href="https://stackoverflow.com/questions/12938388/jasmine-test-does-not-see-angularjs-module">Jasmine test does not see AngularJS module</a>)</p>
  
  <p>I just want to test a service without bootstrapping Angular.</p>
  
  <p>I have look at some examples and the tutorial but I am not going anywhere.</p>
  
  <p>I have just three files:</p>
  
  <ul>
  <li><p>myService.js: where I define an AngularJS service</p></li>
  <li><p>test_myService.js: where I define a Jasmine test for the service.</p></li>
  <li><p>specRunner.html: a HTML file with the normal jasmine configuration
  and where I import the previous two other files and the Jasmine, Angularjs and angular-mocks.js.</p></li>
  </ul>
  
  <p>This is the code for the service (that works as expected when I am not testing):</p>
  
  <pre><code>var myModule = angular.module('myModule', []);
  
  myModule.factory('myService', function(){
  
      var serviceImplementation   = {};
      serviceImplementation.one   = 1;
      serviceImplementation.two   = 2;
      serviceImplementation.three = 3;
  
      return serviceImplementation
  
  });
  </code></pre>
  
  <p>As I am trying to test the service in isolation, I should be able to access it and check their methods.
  My question is: how can I inject the service in my test without bootstrapping AngularJS?</p>
  
  <p>For instance, how can I test the value returned for a method of the service with Jasmine like this:</p>
  
  <pre><code>describe('myService test', function(){
      describe('when I call myService.one', function(){
          it('returns 1', function(){
              myModule = angular.module('myModule');
                      //something is missing here..
              expect( myService.one ).toEqual(1);
          })
  
      })
  
  });
  </code></pre>