Skip to content

Commit

Permalink
Remove Route class from global namespace - #170
Browse files Browse the repository at this point in the history
  • Loading branch information
kahmali committed Feb 24, 2016
1 parent a3c07ec commit 44aac00
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## Unreleased

#### Fixed
- Remove Route class from global namespace ([#170][])


## [v0.8.4] - 2015-08-18

#### Fixed
Expand Down
2 changes: 1 addition & 1 deletion lib/restivus.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class @Restivus
###
addRoute: (path, options, endpoints) ->
# Create a new route and add it to our list of existing routes
route = new Route(this, path, options, endpoints)
route = new share.Route(this, path, options, endpoints)
@_routes.push(route)

route.addToApi()
Expand Down
2 changes: 1 addition & 1 deletion lib/route.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class @Route
class share.Route

constructor: (@api, @path, @options, @endpoints) ->
# Check if options were provided
Expand Down
4 changes: 3 additions & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Package.onUse(function (api) {
api.use('accounts-base@1.2.0');
api.use('simple:json-routes@1.0.4');

api.addFiles('lib/package-scope-variables.js', 'server');
api.addFiles('lib/auth.coffee', 'server');
api.addFiles('lib/iron-router-error-to-response.js', 'server');
api.addFiles('lib/route.coffee', 'server');
Expand All @@ -37,8 +38,9 @@ Package.onTest(function (api) {
api.use('underscore');
api.use('accounts-base');
api.use('accounts-password');
api.use('mongo')
api.use('mongo');

api.addFiles('lib/route.coffee', 'server');
api.addFiles('test/api_tests.coffee', 'server');
api.addFiles('test/route_unit_tests.coffee', 'server');
api.addFiles('test/authentication_tests.coffee', 'server');
Expand Down
6 changes: 3 additions & 3 deletions test/route_unit_tests.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe 'A route', =>
Api = new Restivus

it 'can be constructed with options', (test) =>
route = new @Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
route = new share.Route Api, 'test-route-1', {authRequired: true, roleRequired: ['admin', 'dev']},
get: -> 'GET test-route-1'

test.equal route.path, 'test-route-1'
Expand All @@ -12,14 +12,14 @@ describe 'A route', =>
test.equal route.endpoints.get(), 'GET test-route-1'

it 'can be constructed without options', (test) =>
route = new @Route Api, 'test-route-2',
route = new share.Route Api, 'test-route-2',
get: -> 'GET test-route-2'

test.equal route.path, 'test-route-2'
test.equal route.endpoints.get(), 'GET test-route-2'

it 'should support endpoints for all HTTP methods', (test) =>
route = new @Route Api, 'test-route-3',
route = new share.Route Api, 'test-route-3',
get: -> 'GET test-route-2'
post: -> 'POST test-route-2'
put: -> 'PUT test-route-2'
Expand Down

0 comments on commit 44aac00

Please sign in to comment.