Fetching contributors…
Cannot retrieve contributors at this time
36 lines (25 sloc) 1.06 KB
Reading Specs
Blah blah blah...
Writing Specs
Here are some general dos and don'ts
= DO:
* Write more specs for error conditions than clean conditions.
* Write specs with readability in mind. Somebody new to DataMapper should be
able to read specs to learn how something works.
* Use existing models that are part of a metaphor.
* Nest describe blocks (2 or 3 levels deep is probably fine).
* Limit a describe block to 10 - 15 examples.
* Group specs by method being tested. (See the 'Ordering Specs' section)
* Use custom matchers.
= DON'T:
* Spec more than one unit of functionality in an example. An example should be
as short as possible (while still remaining readable).
* Spec implementation. Refactoring code should not break specs.
* Declare models in the spec file.
And a final do: Do go against the guidelines if your best judgement tells you
to. These are just guidelines and are obviously not fast rules.
Mocks and Stubs
Do not use mocks or stubs for any specs in DataMapper.