Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 64 lines (47 sloc) 1.358 kB
8bdd93d @robin sync with cheat
authored
1 ---
2 bacon: |-
3 == Implemented assertions
4
5 * should.<predicate> and should.be.<predicate>
6 * should.equal
7 * should.match
8 * should.be.identical_to / should.be.same_as
9 * should.raise(*exceptions) { }
10 * should.change { }
11 * should.throw(symbol) { }
12 * should.satisfy { |object| }
13
14
15 == Added core predicates
16
17 * Object#true?
18 * Object#false?
19 * Proc#change?
20 * Proc#raise?
21 * Proc#throw?
22 * Numeric#close?
23
24 == before/after
25
26 before and after need to be defined before the first specification in
27 a context and are run before and after each specification.
28
29 describe 'A new array' do
30 before do
31 @ary = Array.new
32 end
33 # ...
34 end
35
36 == Shared contexts
37
38 shared "an empty container" do
39 it "should have size zero" do
40 end
41
42 it "should be empty" do
43 end
44 end
45
46 context "A new array" do
47 behaves_like "an empty container"
48 end
49
50 These contexts are not executed on their own, but can be included with
51 behaves_like in other contexts. You can use shared contexts to
52 structure suites with many recurring specifications.
53
54 == Matchers
55
56 def shorter_than(max_size)
57 lambda { |obj| obj.size < max_size }
58 end
59
60 [1,2,3].should.be shorter_than(5)
61
62 You can use modules and extend to group matchers for use in multiple
63 contexts.
Something went wrong with that request. Please try again.