Skip to content
rudylattae edited this page Nov 10, 2010 · 3 revisions

Context

The current design of Jasmine makes the grammar ("describe" and "it"), automatically available in the global namespace. The http://github.com/velesin/jasmine-jquery extension (as an example), defines its extensions within namepaces in Jasmine and attaches the functionality to the active jasmine suite.

Challenge

The goal of jasmine-species is to provide the user with alternative BDD grammar that suites a particular style of generating specifications. Some examples are

  • Feature/Story -> Scenario
  • Given -> When -> Then
  • Concern -> Context -> Observation, etc.

As illustrated by the above examples, there are multiple styles of grammar to choose from depending on the user's tastes/context. As such it would be harsh to "pollute" the user's global namespace with all these elements when maybe all they need for the work at hand is the Feature/Story grammar.

It is therefore essential to contain these elements in descriptive namespaces to make it possible for the user to "import" only the grammar they need into the global namespace.

Solution

To give the user some flexibility, all the aroma functionality should be contained in the namespace:

jasmine.grammar

The reporting components would be contained in the namespace:

jasmine.reporting

With this I am assuming that the pivotal guys will not be using "jasmin.grammar" or "jasmine.reporting" for anything -- (shiver). What? you don't agree -- well life's short don't sweat it!

Clone this wiki locally