title: Stub object function which resolves with a function
body: <p>I'm trying to use sinon to stub the <code>save</code> method in this object</p>
  
  <pre><code>const db = {
    user: {
      findOne: () =&gt; Promise.resolve({
        id: '43214321-4321-4321-4321-432143214321',
        save: () =&gt; Promise.resolve({ // I WANTED TO STUB THIS METHOD
          id: '43214321-4321-4321-4321-432143214321'
        })
      })
    }
  }
  </code></pre>
  
  <p>Via this</p>
  
  <pre><code>beforeEach(() =&gt; {
    sinon.stub(db.user.findOne, 'save').rejects()
  })
  </code></pre>
  
  <p>And I'm getting this error</p>
  
  <pre><code> TypeError: Cannot stub non-existent own property save
  </code></pre>