Permalink
Browse files

add mocha test for where clauses with periods

  • Loading branch information...
kieran committed Feb 28, 2014
1 parent 8bdf10c commit 6f30ab5d11422a8dce749c127c832f030eecda82
Showing with 18 additions and 0 deletions.
  1. +18 −0 tests/mocha.coffee
View
@@ -129,6 +129,24 @@ describe 'Barista', ->
assert.equal paramsIn[key], paramsOut[key]
+
+ describe 'a where clause with a period', ->
+
+ beforeEach ->
+ router.match('/sites/:id/edit','GET').to('sites.edit').where(id:/[\w.]+/)
+
+ it 'params should match', ->
+ paramsIn =
+ method: 'GET'
+ controller: 'sites'
+ action: 'edit'
+ id: 'site.ru'
+
+ paramsOut = router.first '/sites/site.ru/edit', 'GET'
+
+ for key, val of paramsIn
+ assert.equal paramsIn[key], paramsOut[key]
+
# describe 'a keyed route', ->
# it 'should not throw an exception', ->
# route = router.match '/:controller/:action/:id'

0 comments on commit 6f30ab5

Please sign in to comment.