title: Unit-testing ngResource $save
body: <p>I have a resource which wraps a RESTful API.  I use that resource from my controller to create new objects and save them, similar to this snippet from the Angular docs:</p>
  
  <pre><code>var newCard = new CreditCard({number:'0123'});
  newCard.name = "Mike Smith";
  newCard.$save();
  </code></pre>
  
  <p>When writing a unit test in Jasmine, I get the following error when the $save call is executed: "Cannot read property '$promise' of undefined". </p>
  
  <p>What's the best approach to testing the method in my controller which contains the above code?</p>