twolfson / doubleshot

Run separated BDD outlines and content on Mocha
MIT License
1 stars 0 forks source link

Add content methods as properties of `this` inside of content #13

Open twolfson opened 11 years ago

twolfson commented 11 years ago

How practical would it be to have this also access the content properties?

The repercussions would require a default value system which means cleaning up the batch context as discussed in #5

The benefit would be doing something like:

'addParam': function (name, val) {
  this.params[name] = val;
},
'when converted from left to right': function () {
  this.addParam('layout', 'left-right');
}

For default base contexts, we might do something like:

'*': { // or 'default' or some other special key
  this.params = {};
}
twolfson commented 11 years ago

A few months later and I still think this is a great idea. I am not sure why I wanted a default base context, that seems like overkill.

twolfson commented 11 years ago

By default, expose the methods as before functions. As properties of those methods, we have before, after, beforeEach, afterEach methods which are .bind(suite.ctx).