The scenario verifies the exact expected function call sequence including the function arguments. Scenarios are specified before the code is run, making the tests well organized, readable and more explicit.
The scenario abstraction verifies that things happen exactly as specified: i.e. we do not only verify that some mock function was called with specific paramenter, we verify that it has not been called more times that it should have been, with some other parameters.
Original concepts were carried over from Voodoo-Mock, a C++/Python unit test framework.
$ npm install aroma-mock
You will also probably want to
$ npm install mocha coffee-script
Running CoffeeScript Tests with Mocha
In the following examples I use Mocha for a test runner. In order for Mocha to work with CoffeeScript you must use it like this:
$ mocha --compilers coffee:coffee-script/register [tests...]
coffee-script/register in your test code, and then requiring
Here's an example test, that mocks the jQuery $ symbol and tests that it is
used as expected. Before reading the entire thing, let's just look at the