Add spec for responseHeaders in andRaturn method

This commit is contained in:
Tomek Wytrebowicz 2015-02-17 09:58:10 +01:00
parent ccb0ae7853
commit f0b3027f18

View File

@ -51,6 +51,15 @@ describe("Webmock style mocking", function() {
expect(response.status).toEqual(200);
});
it("should set the responseHeaders", function() {
mockAjax.stubRequest("http://example.com/someApi").andReturn({
responseText: "hi!",
responseHeaders: [{name: "X-Custom", value: "header value"}]
});
sendRequest(fakeGlobal);
expect(response.getResponseHeader('X-Custom')).toEqual('header value');
});
describe("with another stub for the same url", function() {
beforeEach(function() {
mockAjax.stubRequest("http://example.com/someApi").andReturn({responseText: "no", status: 403});