Skip to content

Commit

Permalink
fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescarr committed Jan 16, 2012
1 parent 19716a8 commit 21ba481
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -5,6 +5,7 @@
, "dependencies": {
"express": "2.5.4"
, "jade": ">= 0.0.1"
, "mongoose": "2.4.1"
}
, "devDependencies": {
"mocha": "0.10.0"
Expand Down
1 change: 1 addition & 0 deletions routes/index.coffee
Expand Up @@ -14,6 +14,7 @@ module.exports =
post.id = posts.length
posts.push post
res.redirect "/"

viewPost: (req, res) ->
post = posts[req.params.id]
res.render 'post', post: post, title: post.title
Expand Down
12 changes: 7 additions & 5 deletions test/routes-test.coffee
Expand Up @@ -4,6 +4,7 @@ require "should"
describe "routes", ->
req =
params: {}
body: {}
res =
redirect: (route) ->
# do nothing
Expand All @@ -29,11 +30,12 @@ describe "routes", ->
req.body.post =
title: "My Post!"
body: "My wonderful post."
res.render = (view, vars) ->

routes.addPost req, redirect: (route) ->
route.should.eql "/"
routes.index req, render: (view, vars) ->
view.should.equal "index"
vars.posts.should.eql [{title: 'My Post!', body: "My wonderful post."}]
vars.posts.should.eql [{id: 0, title: 'My Post!', body: "My wonderful post."}]
done()

routes.addPost req, res
routes.index req, res


0 comments on commit 21ba481

Please sign in to comment.