forked from datamapper/dm-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SPECS
35 lines (25 loc) · 1.06 KB
/
SPECS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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.