Created
April 6, 2016 12:13
-
-
Save lukemorton/e15bf100186a5fb4b36a02edef4999b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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