Created
September 29, 2011 20:32
-
-
Save cadwallion/1251845 to your computer and use it in GitHub Desktop.
Profile Service + Jasmine == Win?
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
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