Parameterized specs with Jasmine
Spock’s where block makes testing similar conditions for a bunch of inputs very straightforward. Recently I was working on the Groovy language definition for the Prism syntax highlighter and wanted something similar.
I used Jasmine to test-drive my code and wanted to be able to make some very similar assertions about how the highlighting operated. For example, a particular code block should contain particular characters highlighted as operator tokens. The assertions for each of Groovy’s (many) operator types would look extremely similar with the only variance being the id of the code block and the expected operator tokens. Using Spock this would be a classic case for writing a single specification method and applying a where block.