Permalink
Browse files

Fixed based on client-side tests.

  • Loading branch information...
1 parent 40780c2 commit d1511a1ccbfded8bd9c6a3cef17e11dc81f48939 @assaf committed Mar 30, 2012
Showing with 11 additions and 7 deletions.
  1. +3 −3 server/models/split_test.coffee
  2. +8 −4 server/test/helper.coffee
@@ -48,7 +48,7 @@ class SplitTest
# Create a new split test with the given identifier. Throws exception is the
# identifier is invalid.
constructor: (id)->
- unless id && /^[\w]+$/.test(id)
+ unless id && /^[\w\-]+$/.test(id)
throw new Error("Split test identifier may only contain alphanumeric, underscore and hyphen")
@_base_key = "#{SplitTest.NAMESPACE}.#{id}"
@@ -172,7 +172,7 @@ class SplitTest
result =
participant: participant
alternative: parseInt(alternative)
- joined: Date.create(score)
+ joined: new Date(parseInt(score))
redis.hget "#{@_base_key}.outcomes", participant, (error, outcome)=>
return callback(error) if error
@@ -185,7 +185,7 @@ class SplitTest
# Get when participant compeleted this test
redis.zscore "#{@_base_key}.completed.#{alternative}", participant, (error, score)->
return callback(error) if error
- result.completed = Date.create(score)
+ result.completed = new Date(parseInt(score))
callback null, result
View
@@ -10,12 +10,16 @@ Activity = require("../models/activity")
Helper =
setup: (callback)->
- Async.series [
+ Async.parallel [
(done)->
- redis.flushdb done
+ redis.flushdb(done)
, (done)->
- server.listen 3003, done
- ], callback
+ server.listen(3003, done)
+ ], (error)->
+ if error
+ throw error
+ else
+ callback()
newIndex: (callback)->
Activity.deleteIndex (error)->

0 comments on commit d1511a1

Please sign in to comment.