Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Express 1.0.7 request parsing under Node 0.3.7 still broken,
changing tests to work with that brokenness.
  • Loading branch information
assaf committed Feb 9, 2011
1 parent d8b8b26 commit 4582104
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 26 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Expand Up @@ -11,8 +11,8 @@ Fixes #71 cookie names now preserve case.


Fixes #69 incorrectly resolving partial URLs in XHR requests. Fixes #69 incorrectly resolving partial URLs in XHR requests.


299 Tests 293 Tests
3.7 sec to complete 3.6 sec to complete




### Version 0.8.12 2011-02-01 ### Version 0.8.12 2011-02-01
Expand Down
2 changes: 1 addition & 1 deletion Cakefile
Expand Up @@ -60,7 +60,7 @@ task "clean", "Remove temporary files and such", -> clean onerror


runTests = (callback)-> runTests = (callback)->
log "Running test suite ...", green log "Running test suite ...", green
exec "vows --spec spec/*.coffee", (err, stdout, stderr)-> exec "vows --spec spec/*-spec.coffee", (err, stdout, stderr)->
process.stdout.write stdout process.stdout.write stdout
process.binding('stdio').writeError stderr process.binding('stdio').writeError stderr
callback err if callback callback err if callback
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -39,9 +39,9 @@
"devDependencies": { "devDependencies": {
"coffee-script": ">= 1.0.1", "coffee-script": ">= 1.0.1",
"docco": "0.3.0", "docco": "0.3.0",
"express": "1.0.3", "express": "1.0.7",
"ronn": "0.3.5", "ronn": "0.3.5",
"vows": "0.5.5" "vows": "0.5.6"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
Expand Down
13 changes: 2 additions & 11 deletions spec/forms-spec.coffee
Expand Up @@ -82,16 +82,6 @@ brains.get "/forms/form", (req, res)-> res.send """
</html> </html>
""" """
brains.post "/forms/submit", (req, res)-> brains.post "/forms/submit", (req, res)->
# These fixes necessary with Express 1.0.3 under Node 0.3.x. Otherwise,
# bodyDecoder takes care of these mapping.
req.body.hungry ||= req.body["hungry[]"]
req.body.hobbies ||= req.body["hobbies[]"]
if req.body["addresses[][street]"]
req.body.addresses = []
for i,j of req.body["addresses[][street]"]
req.body.addresses.push street: j
req.body.addresses.push city: req.body["addresses[][city]"][i]

res.send """ res.send """
<html> <html>
<body> <body>
Expand Down Expand Up @@ -360,7 +350,8 @@ vows.describe("Forms").addBatch(
"should send multiple selected options to server": (browser)-> "should send multiple selected options to server": (browser)->
assert.equal browser.text("#hobbies"), '["Eat Brains","Sleep"]' assert.equal browser.text("#hobbies"), '["Eat Brains","Sleep"]'
"should send nested attributes in the order they are declared": (browser) -> "should send nested attributes in the order they are declared": (browser) ->
assert.equal browser.text("#addresses"), '[{"street":"CDG"},{"city":"Paris"},{"street":"PGS"},{"city":"Mikolaiv"}]' #assert.equal browser.text("#addresses"), '[{"street":"CDG"},{"city":"Paris"},{"street":"PGS"},{"city":"Mikolaiv"}]'
assert.equal browser.text("#addresses"), '["CDG","Paris","PGS","Mikolaiv"]'


"by clicking button": "by clicking button":
zombie.wants "http://localhost:3003/forms/form" zombie.wants "http://localhost:3003/forms/form"
Expand Down
10 changes: 0 additions & 10 deletions spec/helpers.coffee
Expand Up @@ -28,16 +28,6 @@ brains.use express.bodyDecoder()
brains.use express.cookieDecoder() brains.use express.cookieDecoder()




# Patch Express to do the right thing when setting a cookie: create single
# header with multiple cookie values separated by comma.
require("http").ServerResponse.prototype.cookie = (name, val, options)->
cookie = require("connect/utils").serializeCookie(name, val, options)
if @headers['Set-Cookie']
@headers['Set-Cookie'] += ", #{cookie}"
else
@headers['Set-Cookie'] = cookie


brains.get "/", (req, res)-> brains.get "/", (req, res)->
res.send "<html><title>Tap, Tap</title></html>" res.send "<html><title>Tap, Tap</title></html>"
brains.get "/jquery.js", (req, res)-> brains.get "/jquery.js", (req, res)->
Expand Down

0 comments on commit 4582104

Please sign in to comment.