Last active
February 18, 2016 21:51
-
-
Save ebramanti/e124df98f520fa3fae8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('GET potatoes', function() { | |
it('returns JSON with only authenticated robot\'s potatoes', function*() { | |
const glados = yield factory.create('robot'); | |
const gladosPotatoes = [ | |
yield factory.create('potato', { ownerId: glados.id }); | |
yield factory.create('potato', { ownerId: glados.id }); | |
]; | |
const wheatley = yield factory.create('robot'); | |
const wheatleyPotato = | |
yield factory.create('potato', { ownerId: wheatley.id }); | |
const response = yield request.auth(glados).get('/potatoes'); | |
const potatoesResponse = response.body.potatoes; | |
const returnedIds = _.pluck(potatoesResponse, 'id'); | |
expect(returnedIds).to.include(_.pluck(gladosPotatoes, 'id')); | |
expect(returnedIds).not.to.include(wheatleyPotato.id); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment