Redefine a method on an object
<p>I'm trying to do the following:</p>

<pre><code>//Code under test
function Foo() {
  this.do_something_interesting = function() {
    var dependency = new CanYouMockMe();
    if(dependency.i_want_stubbed() === true) {
      //do stuff based on condition
    } else {
      //do stuff if false
    }
  }
}

//Test Code
describe("Foo", function () {
  it("should do something if the dependency returns true", function () {
    var foo = new Foo();
    //how do I stub and/or redefine the "i_want_stubbed" method here?
    var result_if_true = foo.do_something_interesting();
    expect(true).toEqual(result_if_true);
  });
});
</code></pre>

<p>The gist of the question is: how do I redefine an instance method in javascript?</p>
