-
Notifications
You must be signed in to change notification settings - Fork 200
Upgrading
Vance Lucas edited this page Jul 27, 2017
·
3 revisions
A lot has changed since the last Frisby release!
Announcement Issue: https://github.com/vlucas/frisby/issues/316
-
Frisby v2 no longer calls any Jasmine functions like
describe
orit
, etc. You must now define your own jasmine test, and then use Frisby inside it for issuing HTTP requests and running assertions on the response. - Smaller API:
expect(<type>, <...args>)
andexpectNot(<type>, <...args>)
are the only expectation methods now. TheexpectNot
method simply inverts the expectation (i.e. it expects an error to be thrown)
Frisby used to create the whole Jasmine test for you:
var frisby = require('frisby');
frisby.create('should get user Joe Schmoe')
.get(testHost + '/users/1')
.expectStatus(200)
.expectJSONContains({
id: 1,
email: '[email protected]'
})
.toss();
The old way caused lots of issues and limited flexibility, so now Frisby v2 does not:
var frisby = require('frisby');
it('should get user Joe Schmoe', function(doneFn) {
frisby.get(testHost + '/users/1')
.expect('status', 200)
.expect('json', {
id: 1,
email: '[email protected]'
})
.done(doneFn);
});