jasmine mock second method
<p>I am trying to do the following thing in Jasmine but not sure if it is possible :</p>

<p>I Got a service object with 2 methods, A and B.
Method A calls method B (B is in fact a $http call which I do not want to do during my test : I want to mock it).</p>

<p>In my BeforeEach section I do this : 
<code>spyOn(Serviceinstance, 'B').and.callFake(function(){
     return true;
      });</code>   </p>

<p>in my Test : </p>

<pre><code>var result = Serviceinstance.A();
expect(result).toBeTrue();
</code></pre>

<p>Of course, the real code of B returns false.
My problem is that my test always fails. the function provided in the spy is never called by method A. 
On the other hand, If I call B like this : </p>

<pre><code>var result = Serviceinstance.B();
</code></pre>

<p>Then the function of the spy is called, and my test passes.</p>

<p>So should I modify my instance like this : </p>

<pre><code>Serviceinstance.B = function(){return true;}
</code></pre>

<p>because Jasmine cannot mock a "second" level of the call stack ? (seems totally unlikely to me)</p>

<p>I am definitively missing something....</p>