Skip to content

Commit

Permalink
Merge branch 'master' of github.com:balderdashy/sails
Browse files Browse the repository at this point in the history
  • Loading branch information
mikermcneil committed Mar 15, 2016
2 parents 54e2fed + df7b0c5 commit 1d1bb42
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Master

* [ENHANCEMENT] Allow use of `fn` in expanded route targets [e1790b7](https://github.com/balderdashy/sails/commit/e1790b70b35cd7dc50743a63bb169585f8a927f2)
* [BUGFIX] Add blacklist to "update" blueprint action so that it can be used with primary keys that are not "id" [3625](https://github.com/balderdashy/sails/issues/3625)
* [ENHANCEMENT] Allow hooks to be turned off by setting their environment var to the string "false" [3618](https://github.com/balderdashy/sails/issues/3618)
* [BUGFIX] Allow view target syntax for routes to specify deeply-nested views [3604](https://github.com/balderdashy/sails/issues/3604)
Expand All @@ -16,7 +17,7 @@
* [INTERNAL] Force asynchronicity in the optional third argument of `res.view()`/`res.render()` to pave the way for better, request-agnostic view rendering methods. This prevents double-calling of the callback if userland code throws an error. Thanks [@lennym](https://github.com/lennym)! [cd413e15435947aa855e27aab16d9cd9e65ad493](https://github.com/balderdashy/sails/commit/cd413e15435947aa855e27aab16d9cd9e65ad493)
* [ENHANCEMENT] Improve auto-migrate prompt, and skip the prompt and log an info message instead if `sails.config.models.migrate` is being automatically set to production anyways. [sails-hook-orm/commit/3161c34edbe0aa07055f8665493734dda1688c2a](https://github.com/balderdashy/sails-hook-orm/commit/3161c34edbe0aa07055f8665493734dda1688c2a)
* [ENHANCEMENT] Add production check in case sails-disk is being used, and experimental `sails.config.orm.skipProductionWarnings` flag for preventing the warning. [sails-hook-orm/commit/9a0d46e135dadf00bc4576341624a31e50b12838](https://github.com/balderdashy/sails-hook-orm/commit/9a0d46e135dadf00bc4576341624a31e50b12838)

* [INTERNAL] Don't clone target function in expanded route syntax [6cfb2de](https://github.com/balderdashy/sails/commit/6cfb2de17ccafd789d4af001934b286bc189d1a4)

### 0.12.1

Expand Down
4 changes: 2 additions & 2 deletions lib/router/bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ function bind( /* path, target, verb, options */ ) {

// If target is an object with a `target`, pull out the rest
// of the keys as route options and then bind the target.
else if (_.isPlainObject(target) && target.target) {
var _target = target.target;
else if (_.isPlainObject(target) && (target.target || target.fn)) {
var _target = target.target || target.fn;
options = _.merge(options, _.omit(target, 'target'));
bind.apply(this, [path, _target, verb, options]);
}
Expand Down
28 changes: 28 additions & 0 deletions test/unit/router.bind.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,34 @@ describe('Router.bind', function() {
});
});

$Router.bind('get /footarg', {target: RESPOND.HELLO})
.expectBoundRoute({
path: '/footarg',
method: 'get'
})
.test(function() {
it('should send expected response (get /footarg)', function(done) {
supertest(this.sails.router._privateRouter)
.get('/foo')
.expect(200, 'hello world!')
.end(done);
});
});

$Router.bind('get /foofn', {fn: RESPOND.HELLO})
.expectBoundRoute({
path: '/foofn',
method: 'get'
})
.test(function() {
it('should send expected response (get /foofn)', function(done) {
supertest(this.sails.router._privateRouter)
.get('/foo')
.expect(200, 'hello world!')
.end(done);
});
});

$Router.bind('/bar', RESPOND.HELLO)
.expectBoundRoute({
path: '/bar',
Expand Down

0 comments on commit 1d1bb42

Please sign in to comment.