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.
- data/HISTORY +26 -17
- data/README.rdoc +3 -3
- data/Syckfile +2 -3
- data/lib/ae.rb +3 -2
- data/lib/ae/assert.rb +5 -0
- data/lib/ae/assertion.rb +8 -0
- data/lib/ae/assertor.rb +15 -15
- data/lib/ae/core_ext.rb +0 -1
- data/lib/ae/legacy.rb +12 -7
- metadata +46 -36
- data/COPYING +0 -789
- data/meta/authors +0 -1
- data/meta/contact +0 -1
- data/meta/created +0 -1
- data/meta/description +0 -2
- data/meta/homepage +0 -1
- data/meta/license +0 -1
- data/meta/name +0 -1
- data/meta/released +0 -1
- data/meta/repository +0 -1
- data/meta/ruby +0 -2
- data/meta/suite +0 -1
- data/meta/summary +0 -1
- data/meta/title +0 -1
- data/meta/version +0 -1
- data/test/demos/01_overview.rdoc +0 -92
- data/test/demos/02_assertion.rdoc +0 -1
- data/test/demos/03_assert.rdoc +0 -284
- data/test/demos/04_subjunctive.rdoc +0 -100
- data/test/demos/05_expect.rdoc +0 -84
data/test/demos/05_expect.rdoc
DELETED
@@ -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
|
-
|