Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add tests to ensure before-filters after a skipped filter still get

called
  • Loading branch information...
commit dbf6219994089c3b83a694ee16d62b9d23b31f0b 1 parent 4a5e2e5
@larzconwell larzconwell authored
Showing with 36 additions and 0 deletions.
  1. +36 −0 test/controllers/base_controller.js
View
36 test/controllers/base_controller.js
@@ -106,6 +106,42 @@ tests = {
c._handleAction('foo');
}
+, 'action with multiple async before-filters and "except" on the first': function (next) {
+ var c = createController()
+ , incr = 0;
+ c.foo = function () {
+ assert.equal(1, incr);
+ next();
+ };
+ c.before(function (n) {
+ incr++;
+ n();
+ }, {async: true, except: ['foo']});
+ c.before(function (n) {
+ incr++;
+ n();
+ }, {async: true});
+ c._handleAction('foo');
+ }
+
+, 'action with multiple async before-filters and "only" on the first': function (next) {
+ var c = createController()
+ , incr = 0;
+ c.foo = function () {
+ assert.equal(1, incr);
+ next();
+ };
+ c.before(function (n) {
+ incr++;
+ n();
+ }, {async: true, only: ['bar']});
+ c.before(function (n) {
+ incr++;
+ n();
+ }, {async: true});
+ c._handleAction('foo');
+ }
+
/*
, 'action with sync after-filter': function (next) {
var c = createController()

1 comment on commit dbf6219

@mde
Owner

Nice work, thanks!

Please sign in to comment.
Something went wrong with that request. Please try again.