       expect(book.$id).toEqual(1)
       return
     it "saves fresh instance", ->
-      book = new Book({ title: "The Jungle" })
-      book.$save()
-      $httpBackend.when('POST', '/api/v1/books/').respond(200, { id: 1, title: "The Jungle" })
-      $httpBackend.flush()
-      book.$promise.then jasmine.createSpy('success')
-      $rootScope.$digest()
+      $httpBackend.expect('POST', '/api/v1/books/').respond(200, { id: 1, title: "The Jungle" })
+      book = new Book({ title: "The Jungle" })
+      book.$save()
+      $httpBackend.flush()
+      book.$promise.then jasmine.createSpy('success')
+      $rootScope.$digest()
+      expect(book.id).toBeDefined()
+      expect(book.id).toEqual(1)
       expect(book.title).toEqual("The Jungle")
       return
     it "saves changed values of existing instance", ->

      expect(result).toBe(book)
      return
    it "uses correct REST endpoint for fresh instance", ->
      book = new Book({ title: "The Jungle" })
      book.$save()
      $httpBackend.when('POST', '/api/v1/books/').respond(200, { id: 1, title: "The Jungle" })
      $httpBackend.flush()
      return
    it "uses correct REST endpoint for existing instance", ->
      book = Book.Get(1)
      $httpBackend.when('GET', '/api/v1/books/1').respond(200, { id: 1, title: "The Jungle" })
      $httpBackend.flush()
      book.$promise.then jasmine.createSpy('success')
      $rootScope.$digest()
      book.title = "The Jungle 2.0"
      book.$save()
      $httpBackend.when('PUT', '/api/v1/books/1').respond(200, { id: 1, title: "The Jungle 2.0" })
      $httpBackend.flush()
      return
    it "fulfills $promiseDirect for fresh instance", ->

      expect(book.$id).toEqual(1)
      return
    it "returns instance with values from server", ->
      $httpBackend.expect('GET', '/api/v1/books/1').respond(200, { id: 1, title: "The Jungle" })
      book = Book.Get(1)
      $httpBackend.flush()
      book.$promise.then jasmine.createSpy('success')
      $rootScope.$digest()
      expect(book.id).toBeDefined()
      expect(book.id).toEqual(1)
      expect(book.title).toEqual("The Jungle")
      return
    it "returns instance with defaults where not provided by server", ->
