README syntax does not work in tests #3

Closed
vlucas opened this Issue Jan 4, 2012 · 1 comment

Comments

Projects
None yet
2 participants

vlucas commented Jan 4, 2012

I was stuck on this for a few hours trying to get mock tests to run. The syntax displayed in the current README file does NOT work and tests using it to NOT pass. I kept getting errors about the "statusCode" being undefined. I finally gave up to hack the source and discovered that response actually accepts an Object with named keys instead of the parameters in order as shown in the README file.

So instead of this (as shown in the README):

var mockFn = mockRequest.mock()
.get('/not-here')
  .respond(404)
.run();

It is this:

var mockFn = mockRequest.mock()
.get('/not-here')
  .respond({
    statusCode: 404
  })
.run();
Owner

indexzero commented Jun 28, 2012

This project has been deprecated. We suggest using nock: http://github.com/flatiron/nock

@indexzero indexzero closed this Jun 28, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment