Skip to content

Instantly share code, notes, and snippets.

@lukemorton
Created April 6, 2016 12:13
Show Gist options
  • Save lukemorton/e15bf100186a5fb4b36a02edef4999b7 to your computer and use it in GitHub Desktop.
Save lukemorton/e15bf100186a5fb4b36a02edef4999b7 to your computer and use it in GitHub Desktop.
feature('My feature', function () {
scenario('My scenario')
.when(UserDoesSomething)
.then(UserSeesSomething)
})
function scenario(name) {
var fns = [];
function when(fn) {
fns.push(new Promise(fn))
}
function then(fn) {
it(name, function (done) {
fns.push(new Promise(fn));
Promise.all(fns).then(done)
});
}
return {
when: when,
then: then
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment