Created
September 22, 2011 01:15
-
-
Save theycallmeswift/1233801 to your computer and use it in GitHub Desktop.
Expected errors w/ Zombie
This file contains hidden or 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
# So, I have a feature file like the following that is designed to | |
# check that the error routes (404 & 500) are working as expected. | |
{Feature} = require 'vows-bdd' | |
assert = require 'assert' | |
vows = require 'vows' | |
zombie = require 'zombie' | |
server = require '../server' | |
Feature("As a visitor, I can view pages on the website", module) | |
.scenario("As a visitor, I attempt to view a missing page") | |
.given "the server is running", -> | |
server.listen server.port, @callback() | |
.and "the following route that results in a 404 exist", -> | |
server.get('/404', (req, res, next) -> | |
next() | |
) | |
@callback() | |
.when "I visit a page that results in a 404 error", -> | |
zombie.visit "http://localhost:#{server.port}/404", @callback | |
.then "I should recieve an error", (err, browser, status) -> | |
assert.isNotNull err | |
assert.match err.message, /got 404/ | |
.and "the page should respond with a status code of 404", (err, browser, status) -> | |
assert.equal err.response.statusCode, 404 | |
.complete -> | |
server.close() | |
.scenario("As a visitor, I attempt to view a page that causes an error") | |
.given "the server is running", -> | |
server.listen server.port, @callback() | |
.and "the following route that results in a 500 error exist", -> | |
server.get('/500', (req, res, next) -> | |
next(500) | |
) | |
@callback() | |
.when "I visit a page that results in a 500 error", -> | |
zombie.visit "http://localhost:#{server.port}/500", @callback | |
.then "I should recieve an error", (err, browser, status) -> | |
assert.isNotNull err | |
assert.match err.message, /got 500/ | |
.and "the page should respond with a status code of 500", (err, browser, status) -> | |
assert.equal err.response.statusCode, 500 | |
.complete -> | |
server.close() | |
.finish module |
This file contains hidden or 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
[ theycallmeswift ~/dev/personal/blah master ✔ ] NODE_ENV=test coffee features/visitor_views_the_website.coffee | |
error: Loading resource: Could not load resource at http://localhost:3000/404, got 404 - More: | |
Error: Could not load resource at http://localhost:3000/404, got 404 | |
·· error: Loading resource: Could not load resource at http://localhost:3000/500, got 500 - More: | |
Error: Could not load resource at http://localhost:3000/500, got 500 | |
·· ✓ OK » 4 honored (0.050s) | |
How can I get rid of those error messages ^^^^ |
Any updates on solving this?
According to the developer this is fixed in the latest release. Anyone tried it yet?
I tried. Still no luck.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I overlooked it.
My bad.