ae 1.2 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,84 +0,0 @@
1
- = Expect Method
2
-
3
- Expect is another optional assertion nomenclature available
4
- for use in your tests or specifications. Inspired by Jay Fields'
5
- Expectations library, it provides convenient syntax for creating
6
- exception and case equality assertions.
7
-
8
- require 'ae/expect'
9
-
10
- == Underlying Comparison
11
-
12
- Expect uses #=== for comparison. So providing an argument and a block to
13
- #expect we can test for a somewhat broader range of compassion than #assert.
14
- For example we can test for a subclass.
15
-
16
- expect Numeric do
17
- 3
18
- end
19
-
20
- Assertion.assert.raised? do
21
- expect Numeric do
22
- "3"
23
- end
24
- end
25
-
26
-
27
- == Exception Expectation
28
-
29
- If the comparator is an Exception class or a instance of an Exception class,
30
- then #expect will check to see if the block raises that kind of exception.
31
-
32
- expect StandardError do
33
- some_undefined_method
34
- end
35
-
36
- expect Assertion do
37
- expect(nil)
38
- end
39
-
40
- This is an important distinction to note because it means #expect can not be used
41
- if verify instances of Exception classes.
42
-
43
- Assertion.assert.raised? do
44
- expect Exception do
45
- Exception.new
46
- end
47
- end
48
-
49
-
50
- == Regex Expectations
51
-
52
- That #expect entails #=== also means we can check for Regexp matches.
53
-
54
- expect /x/ do
55
- "oooxooo"
56
- end
57
-
58
-
59
- == Expected Method
60
-
61
- We can use #expected to make the receiver the object of expectation.
62
-
63
- x = "dummy"
64
-
65
- /x/.expected do
66
- "x"
67
- end
68
-
69
-
70
- == Function without Block
71
-
72
- Without a block, the receiver is compared to the argument.
73
-
74
- x.expect String
75
-
76
-
77
- == Functor, or Higher Order Function
78
-
79
- Like #assert, #expect can be used used as a *fluid* notation.
80
-
81
- 10.expect == 10
82
-
83
- In which case it works just like #assert.
84
-