I have tried to mock/stub my ajax call, but it looks like it only works with text. When I tried to set response with object then my done callback is not called:
jasmine.Ajax.stubRequest('/some_url/1').andReturn({
//"responseText": response ,
"response": response,
"status": 200
});
, but when I set responseText with object then it is called, but the responseJSON is not set, when debug response in FF
responseJSON undefined
status 200
statusText "success"
Am I doing something wrong or it is an issue?
I am using Jasmine 2.1.3 and latest version of jasmine-ajax (honestly I cannot figure it out where I can find version I am using...;-), I've just downloaded mock-ajax.js from link in documentation in github)
UPDATE:
It was my bad. I have tried to push plain Object
, when used JSON.stringify
and pass the result to "responseText" it works!