Skip to content

Instantly share code, notes, and snippets.

@cadwallion
Created September 29, 2011 20:32
Show Gist options
  • Save cadwallion/1251845 to your computer and use it in GitHub Desktop.
Save cadwallion/1251845 to your computer and use it in GitHub Desktop.
Profile Service + Jasmine == Win?
var test = require('../spec_helper');
beforeEach(function() {
this.addMatchers({
toErrorWith: function (expectedMessage) {
var resp = this.actual;
this.actual = resp['error'];
this.message = function() {
return "Expected response to return error '"+expectedMessage+"'";
}
return (this.actual == expectedMessage);
}
})
})
describe('Profile Retrieval', function() {
describe('grabbing profile without auth credentials', function() {
it('should return forbidden with an error message', function() {
// stub
ApiHelper.get("/v1/profile/42", function(error, response, body) {
expect(response.statusCode).toEqual(403);
expect(body).toErrorWith('login required')
})
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment