Re: [rspec-users] what would be the best way to stub out an XHR request's response?

2012-09-26 Thread Ervin Weber
You could create some function (say window.GiveMeUrlForAjax) that returns uri for ajax request, your test could then easily overwrite that function before triggering event to perform ajax. Also you might consider creating a function that returns data (in production it would take url from

Re: [rspec-users] what would be the best way to stub out an XHR request's response?

2012-09-26 Thread Adam Sroka
I would just wrap the method that makes the ajax call and spec it from Jasmine. Then you can just stub the wrapper to return the data you want and expect the right thing to happen in the callback method (or however the data gets stored/displayed.) On Wed, Sep 26, 2012 at 10:26 AM, Ervin Weber