mofo 0.2.2 → 0.2.3
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/CHANGELOG +6 -0
- data/Manifest.txt +55 -0
- data/Rakefile +32 -0
- data/init.rb +2 -0
- data/lib/microformat.rb +39 -6
- data/lib/mofo/hentry.rb +4 -0
- data/site/index.html +382 -0
- data/site/mofo-logo.png +0 -0
- data/site/mootools.v1.00.js +2 -0
- data/site/style.css +159 -0
- data/test/base_url_test.rb +22 -0
- data/test/fixtures/corkd.html +1 -1
- data/test/hatom_test.rb +1 -1
- data/test/hreview_test.rb +4 -3
- data/test/include_pattern_test.rb +1 -1
- data/test/test_helper.rb +17 -6
- metadata +63 -115
- data/test/format_test.rb +0 -230
- data/vendor/testspec-0.3.0/ChangeLog +0 -177
- data/vendor/testspec-0.3.0/README +0 -289
- data/vendor/testspec-0.3.0/ROADMAP +0 -1
- data/vendor/testspec-0.3.0/Rakefile +0 -151
- data/vendor/testspec-0.3.0/SPECS +0 -108
- data/vendor/testspec-0.3.0/TODO +0 -2
- data/vendor/testspec-0.3.0/bin/specrb +0 -104
- data/vendor/testspec-0.3.0/doc/classes/Kernel.html +0 -140
- data/vendor/testspec-0.3.0/doc/classes/Object.html +0 -155
- data/vendor/testspec-0.3.0/doc/classes/Test/Spec.html +0 -128
- data/vendor/testspec-0.3.0/doc/classes/Test/Spec/CustomShould.html +0 -236
- data/vendor/testspec-0.3.0/doc/classes/Test/Spec/DefinitionError.html +0 -111
- data/vendor/testspec-0.3.0/doc/classes/Test/Spec/Should.html +0 -884
- data/vendor/testspec-0.3.0/doc/classes/Test/Spec/ShouldNot.html +0 -487
- data/vendor/testspec-0.3.0/doc/classes/Test/Spec/TestCase.html +0 -220
- data/vendor/testspec-0.3.0/doc/classes/Test/Spec/TestCase/ClassMethods.html +0 -318
- data/vendor/testspec-0.3.0/doc/classes/Test/Spec/TestCase/InstanceMethods.html +0 -195
- data/vendor/testspec-0.3.0/doc/classes/Test/Unit/UI/RDox/TestRunner.html +0 -222
- data/vendor/testspec-0.3.0/doc/classes/Test/Unit/UI/SpecDox/TestRunner.html +0 -476
- data/vendor/testspec-0.3.0/doc/created.rid +0 -1
- data/vendor/testspec-0.3.0/doc/files/README.html +0 -516
- data/vendor/testspec-0.3.0/doc/files/ROADMAP.html +0 -109
- data/vendor/testspec-0.3.0/doc/files/SPECS.html +0 -386
- data/vendor/testspec-0.3.0/doc/files/lib/test/spec/dox_rb.html +0 -108
- data/vendor/testspec-0.3.0/doc/files/lib/test/spec/rdox_rb.html +0 -108
- data/vendor/testspec-0.3.0/doc/files/lib/test/spec/should-output_rb.html +0 -115
- data/vendor/testspec-0.3.0/doc/files/lib/test/spec_rb.html +0 -123
- data/vendor/testspec-0.3.0/doc/fr_class_index.html +0 -38
- data/vendor/testspec-0.3.0/doc/fr_file_index.html +0 -33
- data/vendor/testspec-0.3.0/doc/fr_method_index.html +0 -102
- data/vendor/testspec-0.3.0/doc/index.html +0 -24
- data/vendor/testspec-0.3.0/doc/rdoc-style.css +0 -208
- data/vendor/testspec-0.3.0/examples/stack.rb +0 -38
- data/vendor/testspec-0.3.0/examples/stack_spec.rb +0 -119
- data/vendor/testspec-0.3.0/lib/test/spec.rb +0 -490
- data/vendor/testspec-0.3.0/lib/test/spec/dox.rb +0 -122
- data/vendor/testspec-0.3.0/lib/test/spec/rdox.rb +0 -25
- data/vendor/testspec-0.3.0/lib/test/spec/should-output.rb +0 -49
- data/vendor/testspec-0.3.0/test/spec_dox.rb +0 -39
- data/vendor/testspec-0.3.0/test/spec_flexmock.rb +0 -210
- data/vendor/testspec-0.3.0/test/spec_mocha.rb +0 -118
- data/vendor/testspec-0.3.0/test/spec_nestedcontexts.rb +0 -26
- data/vendor/testspec-0.3.0/test/spec_should-output.rb +0 -26
- data/vendor/testspec-0.3.0/test/spec_testspec.rb +0 -522
- data/vendor/testspec-0.3.0/test/spec_testspec_order.rb +0 -26
- data/vendor/testspec-0.3.0/test/test_testunit.rb +0 -21
data/test/format_test.rb
DELETED
@@ -1,230 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
require 'mofo/hcard'
|
3
|
-
require 'mofo/hreview'
|
4
|
-
|
5
|
-
context "A simple hcard definition" do
|
6
|
-
specify "should parse a page with an hcard" do
|
7
|
-
proc { HCard.find(fixture(:fauxtank)) }.should.not.raise MicroformatNotFound
|
8
|
-
end
|
9
|
-
|
10
|
-
specify "should raise an error if no hcard is found in strict mode" do
|
11
|
-
proc { HCard.find(fixture(:fake), :strict => true) }.should.raise MicroformatNotFound
|
12
|
-
end
|
13
|
-
|
14
|
-
specify "should return an empty array if no hcard is found" do
|
15
|
-
HCard.find(fixture(:fake)).should.equal []
|
16
|
-
end
|
17
|
-
|
18
|
-
specify "should return nil if no hcard is found with :first" do
|
19
|
-
HCard.find(:first => fixture(:fake)).should.equal nil
|
20
|
-
end
|
21
|
-
|
22
|
-
specify "should return nil if no hcard is found with :all" do
|
23
|
-
HCard.find(:all => fixture(:fake)).should.equal []
|
24
|
-
end
|
25
|
-
|
26
|
-
specify "should accept a :text option" do
|
27
|
-
HCard.find(:text => open(fixture(:fauxtank)).read).should.not.equal []
|
28
|
-
HCard.find(:text => open(fixture(:fauxtank)).read).should.not.equal nil
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context "The parsed fauxtank hCard object" do
|
33
|
-
setup do
|
34
|
-
$fauxtank ||= HCard.find(:first => fixture(:fauxtank))
|
35
|
-
end
|
36
|
-
|
37
|
-
specify "should be an instance of HCard" do
|
38
|
-
$fauxtank.should.be.an.instance_of HCard
|
39
|
-
end
|
40
|
-
|
41
|
-
specify "should have `fauxtank' as the nickname" do
|
42
|
-
$fauxtank.nickname.should.equal "fauxtank"
|
43
|
-
end
|
44
|
-
|
45
|
-
specify "should have two email addresses" do
|
46
|
-
$fauxtank.email.size.should.equal 2
|
47
|
-
$fauxtank.email.first.should.equal "fauxtank [at] gmail.com"
|
48
|
-
$fauxtank.email.last.should.equal "chris [at] fauxtank.com"
|
49
|
-
end
|
50
|
-
|
51
|
-
specify "should have `Chris' as the given name" do
|
52
|
-
$fauxtank.n.given_name.should.equal "Chris"
|
53
|
-
end
|
54
|
-
|
55
|
-
specify "should have `Murphy' as the family name" do
|
56
|
-
$fauxtank.n.family_name.should.equal "Murphy"
|
57
|
-
end
|
58
|
-
|
59
|
-
specify "should have `Chicago' as the locality" do
|
60
|
-
$fauxtank.adr.locality.should.equal "Chicago"
|
61
|
-
end
|
62
|
-
|
63
|
-
specify "should have `United States' as the country-name" do
|
64
|
-
$fauxtank.adr.country_name.should.equal "United States"
|
65
|
-
end
|
66
|
-
|
67
|
-
specify "should have fauxtank's profile pic as the logo" do
|
68
|
-
$fauxtank.logo.should.equal "http://static.flickr.com/25/buddyicons/89622800@N00.jpg?1128967902"
|
69
|
-
end
|
70
|
-
|
71
|
-
specify "should know what properties it found" do
|
72
|
-
$fauxtank.properties.sort.should.equal ["fn", "note", "n", "email", "logo", "adr", "nickname", "title", "url"].sort
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context "The parsed Bob hCard object" do
|
77
|
-
setup do
|
78
|
-
$bob ||= HCard.find(:first => fixture(:bob))
|
79
|
-
end
|
80
|
-
|
81
|
-
specify "should have three valid emails with type information" do
|
82
|
-
$bob.email.value.size.should.equal 3
|
83
|
-
$bob.email.type.first.should.equal 'home'
|
84
|
-
$bob.email.value.first.should.equal 'bob@gmail.com'
|
85
|
-
$bob.email.type[1].should.equal 'work'
|
86
|
-
$bob.email.value[1].should.equal 'robert@yahoo.com'
|
87
|
-
$bob.email.type.last.should.equal 'home'
|
88
|
-
$bob.email.value.last.should.equal 'bobby@gmail.com'
|
89
|
-
end
|
90
|
-
|
91
|
-
specify "should have two valid telephone numbers with type information" do
|
92
|
-
$bob.tel.type.size.should.equal 2
|
93
|
-
$bob.tel.type.first.should.equal 'home'
|
94
|
-
$bob.tel.value.first.should.equal '707-555-9990'
|
95
|
-
$bob.tel.type.last.should.equal 'cell'
|
96
|
-
$bob.tel.value.last.should.equal '707-555-4756'
|
97
|
-
end
|
98
|
-
|
99
|
-
specify "should have a given, additional, and family name" do
|
100
|
-
$bob.n.given_name.should.equal 'Robert'
|
101
|
-
$bob.n.additional_name.should.equal 'Albert'
|
102
|
-
$bob.n.family_name.should.equal 'Smith'
|
103
|
-
end
|
104
|
-
|
105
|
-
specify "should have a valid url" do
|
106
|
-
$bob.url.should.equal "http://nubhub.com/bob"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context "The parsed Firesteed hReview object" do
|
111
|
-
setup do
|
112
|
-
$firesteed ||= HReview.find(:first => fixture(:corkd))
|
113
|
-
end
|
114
|
-
|
115
|
-
specify "should have a valid, coerced dtreviewed field" do
|
116
|
-
$firesteed.dtreviewed.should.be.an.instance_of Time
|
117
|
-
end
|
118
|
-
|
119
|
-
specify "should have a rating of 5" do
|
120
|
-
$firesteed.rating.should.equal 5
|
121
|
-
end
|
122
|
-
|
123
|
-
specify "should have a description" do
|
124
|
-
$firesteed.description.should.equal %[This is probably my favorite every day (well, not every day) wine. It's light, subtly sweet, ripe fruit, slightly spicy oak. It's a bit "slippery", if that makes sense (in a very good way). Highly drinkable.]
|
125
|
-
end
|
126
|
-
|
127
|
-
specify "should have an HCard as the reviewer" do
|
128
|
-
$firesteed.reviewer.fn.should.equal "simplebits"
|
129
|
-
$firesteed.reviewer.photo.should.equal "/img/icon-user-64.gif"
|
130
|
-
$firesteed.reviewer.url.should.equal "/people/simplebits"
|
131
|
-
end
|
132
|
-
|
133
|
-
specify "should have a valid item" do
|
134
|
-
$firesteed.item.fn.should.equal "Firesteed 2003 Pinot Noir"
|
135
|
-
end
|
136
|
-
|
137
|
-
specify "should have 7 tags" do
|
138
|
-
$firesteed.tags.size.should.equal 7
|
139
|
-
$firesteed.tags.first.should.equal "berry"
|
140
|
-
$firesteed.tags.last.should.equal "sweet"
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
context "The parsed simple hCard object" do
|
145
|
-
setup do
|
146
|
-
$simple ||= HCard.find(:first => fixture(:simple))
|
147
|
-
end
|
148
|
-
|
149
|
-
specify "should have an org string" do
|
150
|
-
$simple.org.should.be.an.instance_of String
|
151
|
-
$simple.org.should.equal "Err the Blog"
|
152
|
-
end
|
153
|
-
|
154
|
-
specify "should have an email string" do
|
155
|
-
$simple.email.should.be.an.instance_of String
|
156
|
-
$simple.email.should.equal "chris[at]ozmm[dot]org"
|
157
|
-
end
|
158
|
-
|
159
|
-
specify "should have a valid name" do
|
160
|
-
$simple.fn.should.equal "Chris Wanstrath"
|
161
|
-
end
|
162
|
-
|
163
|
-
specify "should have a valid url" do
|
164
|
-
$simple.url.should.equal "http://ozmm.org/"
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
context "A string should be coercable into" do
|
169
|
-
specify "an integer" do
|
170
|
-
"2".coerce.should.equal 2
|
171
|
-
end
|
172
|
-
|
173
|
-
specify "a float" do
|
174
|
-
"4.0".coerce.should.equal 4.0
|
175
|
-
end
|
176
|
-
|
177
|
-
specify "a datetime" do
|
178
|
-
"1985-03-13".coerce.should.equal Time.parse("1985-03-13")
|
179
|
-
end
|
180
|
-
|
181
|
-
specify "a boolean" do
|
182
|
-
"true".coerce.should.be true
|
183
|
-
"false".coerce.should.be false
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
context "An array of reltag arrays created from the corkd review webpage" do
|
188
|
-
setup do
|
189
|
-
$tags ||= RelTag.find(:all => fixture(:corkd))
|
190
|
-
end
|
191
|
-
|
192
|
-
specify "should consist of 23 tags" do
|
193
|
-
$tags.size.should.equal 23
|
194
|
-
end
|
195
|
-
|
196
|
-
specify "should include the berry and slippery tags" do
|
197
|
-
$tags.flatten.should.include 'berry'
|
198
|
-
$tags.flatten.should.include 'slippery'
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
context "A string with HTML" do
|
203
|
-
specify "should be able to remove the HTML" do
|
204
|
-
string = %[<ol> <li><a href="http://diveintomark.org/xml/blink.xml" type="application/rss+xml">dive into mark b-links</a></li> <li><a href="http://www.thauvin.net/blog/xml.jsp?format=rdf" type="application/rss+xml">Eric's Weblog</a></li> <li><a href="http://intertwingly.net/blog/index.rss2" type="application/rss+xml">Sam Ruby</a></li> <li><a href="http://diveintomark.org/xml/atom.xml" type="application/atom+xml">dive into mark</a></li> <li><a href="http://www.decafbad.com/blog/index.rss" type="application/rss+xml">0xDECAFBAD</a></li> </ol>]
|
205
|
-
string.strip_html.strip.should.equal "dive into mark b-links Eric's Weblog Sam Ruby dive into mark 0xDECAFBAD"
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
context "A web page with three rel tags" do
|
210
|
-
setup do
|
211
|
-
$page ||= <<-EOF
|
212
|
-
<html>
|
213
|
-
<body>
|
214
|
-
<ul>
|
215
|
-
<li><a href="/tags/miracle" rel="tag">miracle</a></li>
|
216
|
-
<li><a href="/tags/wonder" rel="tag">wonder</a></li>
|
217
|
-
<li><a href="/tags/amusement" rel="tag">amusement</a></li>
|
218
|
-
</ul>
|
219
|
-
</body>
|
220
|
-
</html>
|
221
|
-
EOF
|
222
|
-
end
|
223
|
-
|
224
|
-
specify "should produce an array of three RelTag objects" do
|
225
|
-
tags = RelTag.find(:all, :text => $page)
|
226
|
-
tags.should.be.an.instance_of Array
|
227
|
-
tags.size.should.equal 3
|
228
|
-
tags.should.equal ["miracle", "wonder", "amusement"]
|
229
|
-
end
|
230
|
-
end
|
@@ -1,177 +0,0 @@
|
|
1
|
-
Wed Jan 24 12:07:09 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
2
|
-
tagged 0.3
|
3
|
-
|
4
|
-
Wed Jan 24 12:06:23 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
5
|
-
* set VERSION 0.3
|
6
|
-
|
7
|
-
Wed Jan 24 12:05:28 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
8
|
-
* Last minute fixes
|
9
|
-
|
10
|
-
Wed Jan 24 11:51:39 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
11
|
-
* Update docs
|
12
|
-
|
13
|
-
Wed Jan 24 11:50:14 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
14
|
-
* Improve rdoc
|
15
|
-
|
16
|
-
Wed Jan 24 11:40:37 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
17
|
-
* Rename met_by? to matches? to conform latest RSpec
|
18
|
-
|
19
|
-
Tue Jan 16 18:57:27 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
20
|
-
* Improve coverage
|
21
|
-
|
22
|
-
Tue Jan 16 18:56:48 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
23
|
-
* Add hoe
|
24
|
-
|
25
|
-
Tue Jan 16 17:11:05 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
26
|
-
* Some docfixes
|
27
|
-
|
28
|
-
Tue Jan 16 17:07:55 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
29
|
-
* Make test suite use custom shoulds, fix some details
|
30
|
-
|
31
|
-
Tue Jan 16 16:29:12 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
32
|
-
* Add custom shoulds
|
33
|
-
|
34
|
-
Fri Jan 5 15:25:35 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
35
|
-
* Update copyright messages for 2007
|
36
|
-
|
37
|
-
Fri Jan 5 12:24:46 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
38
|
-
* Add should.not.satisfy
|
39
|
-
|
40
|
-
Thu Jan 4 19:09:46 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
41
|
-
* Add disabling with xspecify
|
42
|
-
|
43
|
-
Thu Jan 4 19:03:04 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
44
|
-
* Add #messaging/#blaming
|
45
|
-
|
46
|
-
Thu Jan 4 17:34:00 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
47
|
-
* specrb -a now includes -Ilib by default for easier out-of-the-box testing
|
48
|
-
|
49
|
-
Thu Jan 4 17:30:49 CET 2007 Christian Neukirchen <chneukirchen@gmail.com>
|
50
|
-
* Deprecation of be_close, be_an_instance_of, be_a_kind_of, and be_nil
|
51
|
-
|
52
|
-
Tue Nov 14 13:21:38 CET 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
53
|
-
* Unshift the LOAD_PATH to recreate a more -I-like behavior
|
54
|
-
|
55
|
-
Mon Nov 13 23:03:41 CET 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
56
|
-
* Use Dir.tmpdir for temporary file paths
|
57
|
-
|
58
|
-
Wed Oct 18 18:21:06 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
59
|
-
tagged 0.2
|
60
|
-
|
61
|
-
Wed Oct 18 10:48:25 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
62
|
-
* Update documentation
|
63
|
-
|
64
|
-
Wed Oct 18 10:46:32 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
65
|
-
* Small alias tweak
|
66
|
-
|
67
|
-
Wed Oct 18 10:31:56 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
68
|
-
* Run specrb with "ruby", not the shell
|
69
|
-
|
70
|
-
Wed Oct 18 10:22:05 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
71
|
-
* Rescue seeking
|
72
|
-
|
73
|
-
Wed Oct 18 09:58:22 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
74
|
-
* Add roadmap
|
75
|
-
|
76
|
-
Sun Oct 15 23:47:07 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
77
|
-
* Simplify Rakefile
|
78
|
-
|
79
|
-
Sun Oct 15 23:46:16 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
80
|
-
* Fix should.output with redirection
|
81
|
-
|
82
|
-
Sun Oct 15 22:43:55 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
83
|
-
* Make rake use specrb
|
84
|
-
|
85
|
-
Sun Oct 15 22:34:31 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
86
|
-
* Add specrb, a standalone test/spec runner
|
87
|
-
|
88
|
-
Sun Oct 15 22:25:49 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
89
|
-
* A better fix for empty testcases
|
90
|
-
|
91
|
-
Sat Oct 14 17:08:23 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
92
|
-
* Make test/spec more robust
|
93
|
-
|
94
|
-
Sat Oct 14 16:42:08 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
95
|
-
* Implement nested contexts
|
96
|
-
|
97
|
-
Sat Oct 14 15:04:04 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
98
|
-
* Fix warnings
|
99
|
-
|
100
|
-
Sat Oct 14 14:59:52 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
101
|
-
* add should <operator> (>, >=, <, <=, ===)
|
102
|
-
|
103
|
-
Wed Oct 11 00:06:17 CEST 2006 Eero Saynatkari <projects@kittensoft.org>
|
104
|
-
* More robust Should#output
|
105
|
-
- Should#output uses IO#reopen and writes
|
106
|
-
directly to a file rather than bothering
|
107
|
-
with StringIO. This should enable catching
|
108
|
-
output from child processes etc. also.
|
109
|
-
|
110
|
-
Mon Oct 2 13:15:59 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
111
|
-
* Add mocha/stubba tests
|
112
|
-
|
113
|
-
Mon Oct 2 13:12:24 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
114
|
-
* Add flexmock tests
|
115
|
-
|
116
|
-
Mon Oct 2 13:11:37 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
117
|
-
* should.raise should return the exception
|
118
|
-
|
119
|
-
Mon Oct 2 13:11:17 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
120
|
-
* Refactor to modules
|
121
|
-
|
122
|
-
Fri Sep 29 20:24:42 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
123
|
-
* Fix warnings, enable -w for testing
|
124
|
-
|
125
|
-
Fri Sep 29 18:26:14 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
126
|
-
tagged 0.1
|
127
|
-
|
128
|
-
Fri Sep 29 18:20:34 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
129
|
-
* Last-minute fixes.
|
130
|
-
|
131
|
-
Fri Sep 29 17:59:57 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
132
|
-
* Fix SPECS generation
|
133
|
-
|
134
|
-
Fri Sep 29 17:36:34 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
135
|
-
* Add VERSION number
|
136
|
-
|
137
|
-
Fri Sep 29 17:35:47 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
138
|
-
* Polish it
|
139
|
-
|
140
|
-
Fri Sep 29 17:34:56 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
141
|
-
* Allow Object#should without specify-block
|
142
|
-
|
143
|
-
Fri Sep 29 17:03:36 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
144
|
-
* Add README
|
145
|
-
|
146
|
-
Fri Sep 29 17:01:31 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
147
|
-
* Test =~
|
148
|
-
|
149
|
-
Fri Sep 29 17:00:53 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
150
|
-
* Fix small mangling bug
|
151
|
-
|
152
|
-
Fri Sep 29 14:50:01 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
153
|
-
* Add RDox
|
154
|
-
|
155
|
-
Fri Sep 29 12:23:40 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
156
|
-
* Add more tests
|
157
|
-
|
158
|
-
Fri Sep 29 12:23:25 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
159
|
-
* Add SpecDox mangling for test/unit method names, too
|
160
|
-
|
161
|
-
Fri Sep 29 12:22:00 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
162
|
-
* Rearranging for rdoc
|
163
|
-
|
164
|
-
Fri Sep 29 12:20:10 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
165
|
-
* Fix rdoc task
|
166
|
-
|
167
|
-
Thu Sep 28 15:36:14 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
168
|
-
* Run contexts in order of appearance
|
169
|
-
|
170
|
-
Thu Sep 28 13:23:48 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
171
|
-
* Add and integrate RDox, TestDox-like output for RDoc
|
172
|
-
|
173
|
-
Wed Sep 27 21:37:54 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
174
|
-
* Integrate Rakefile
|
175
|
-
|
176
|
-
Wed Sep 27 21:37:11 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
|
177
|
-
* Initial import of testspec
|
@@ -1,289 +0,0 @@
|
|
1
|
-
= test/spec, a BDD interface for Test::Unit
|
2
|
-
|
3
|
-
Copyright (C) 2006, 2007 Christian Neukirchen <mailto:chneukirchen@gmail.com>
|
4
|
-
|
5
|
-
|
6
|
-
== What is test/spec?
|
7
|
-
|
8
|
-
test/spec layers an RSpec-inspired interface on top of Test::Unit, so
|
9
|
-
you can mix TDD and BDD (Behavior-Driven Development).
|
10
|
-
|
11
|
-
test/spec is a clean-room implementation that maps most kinds of
|
12
|
-
Test::Unit assertions to a `should'-like syntax.
|
13
|
-
|
14
|
-
Consider this Test::Unit test case:
|
15
|
-
|
16
|
-
class TestFoo < Test::Unit::TestCase
|
17
|
-
def test_should_bar
|
18
|
-
assert_equal 5, 2 + 3
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
In test/spec, it looks like this:
|
23
|
-
|
24
|
-
require 'test/spec'
|
25
|
-
|
26
|
-
context "Foo" do
|
27
|
-
specify "should bar" do
|
28
|
-
(2 + 3).should.equal 5
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
test/spec does not include a mocking/stubbing-framework; use whichever
|
33
|
-
you like to. test/spec has been tested successfully with FlexMock and
|
34
|
-
Mocha.
|
35
|
-
|
36
|
-
test/spec has no dependencies outside Ruby 1.8.
|
37
|
-
|
38
|
-
|
39
|
-
== Mixing test/spec and test/unit
|
40
|
-
|
41
|
-
test/spec and Test::Unit contexts/test cases can be intermixed freely,
|
42
|
-
run in the same test and live in the same files. You can just add them
|
43
|
-
to your Rake::TestTask, too. test/spec allows you to leverage your
|
44
|
-
full existing Test::Unit infrastructure.
|
45
|
-
|
46
|
-
test/spec does not change Test::Unit with the exception of
|
47
|
-
monkey-patching Test::Unit::TestSuite to order the test cases before
|
48
|
-
running them. (This should not do any harm, but if you know a way
|
49
|
-
around it, please tell me.)
|
50
|
-
|
51
|
-
test/spec adds two global methods, Object#should and Kernel.context.
|
52
|
-
|
53
|
-
You can use <tt>assert_*</tt> freely in specify-blocks; Object#should
|
54
|
-
works in plain Test::Unit test cases, too, but they will not be counted.
|
55
|
-
|
56
|
-
|
57
|
-
== Wrapped assertions
|
58
|
-
|
59
|
-
+assert_equal+:: <tt>should.equal</tt>, <tt>should ==</tt>
|
60
|
-
+assert_not_equal+:: <tt>should.not.equal</tt>, <tt>should.not ==</tt>
|
61
|
-
+assert_same+:: <tt>should.be</tt>
|
62
|
-
+assert_not_same+:: <tt>should.not.be</tt>
|
63
|
-
+assert_nil+:: <tt>should.be.nil</tt>
|
64
|
-
+assert_not_nil+:: <tt>should.not.be.nil</tt>
|
65
|
-
+assert_in_delta+:: <tt>should.be.close</tt>
|
66
|
-
+assert_match+:: <tt>should.match</tt>, <tt>should =~</tt>
|
67
|
-
+assert_no_match+:: <tt>should.not.match</tt>, <tt>should.not =~</tt>
|
68
|
-
|
69
|
-
+assert_instance_of+:: <tt>should.be.an.instance_of</tt>
|
70
|
-
+assert_kind_of+:: <tt>should.be.a.kind_of</tt>
|
71
|
-
+assert_respond_to+:: <tt>should.respond_to</tt>
|
72
|
-
+assert_raise+:: <tt>should.raise</tt>
|
73
|
-
+assert_nothing_raised+:: <tt>should.not.raise</tt>
|
74
|
-
+assert_throws+:: <tt>should.throw</tt>
|
75
|
-
+assert_nothing_thrown+:: <tt>should.not.throw</tt>
|
76
|
-
|
77
|
-
+assert_block+:: <tt>should.satisfy</tt>
|
78
|
-
|
79
|
-
(+a+, +an+ and +be+ without arguments are optional and no-ops.)
|
80
|
-
|
81
|
-
|
82
|
-
== Additional assertions
|
83
|
-
|
84
|
-
These assertions are not included in Test::Unit, but have been added
|
85
|
-
to test/spec for convenience:
|
86
|
-
|
87
|
-
* <tt>should.not.satisfy</tt>
|
88
|
-
* <tt>should.include</tt>
|
89
|
-
* <tt>a.should.</tt>_predicate_ (works like <tt>assert
|
90
|
-
a.</tt>_predicate_<tt>?</tt>)
|
91
|
-
* <tt>a.should.be </tt>_operator_ (where _operator_ is one of <tt>></tt>, <tt>>=</tt>, <tt><</tt>, <tt><=</tt> or <tt>===</tt>)
|
92
|
-
* <tt>should.output</tt> (require test/spec/should-output)
|
93
|
-
|
94
|
-
If you write an useful general-purpose assertion, I'd like to hear of
|
95
|
-
it and may add it to the test/spec distribution.
|
96
|
-
|
97
|
-
|
98
|
-
== Messaging/Blaming
|
99
|
-
|
100
|
-
With more complex assertions, it may be helpful to provide a message
|
101
|
-
to show if the assertion has failed. This can be done with the
|
102
|
-
Should#blaming or Should#messaging methods:
|
103
|
-
|
104
|
-
RUBY_VERSION.should.messaging("Ruby too old.").be > "1.8.4"
|
105
|
-
|
106
|
-
(1 + 1).should.blaming("weird math").not.equal 11
|
107
|
-
|
108
|
-
|
109
|
-
== Custom shoulds ("Matchers")
|
110
|
-
|
111
|
-
To capture recurring patterns in parts of your specifications, you can
|
112
|
-
define custom "shoulds" (RSpec calls them "matchers") in your
|
113
|
-
contexts, or include modules of them:
|
114
|
-
|
115
|
-
context "Numbers"
|
116
|
-
class EqualString < Test::Spec::CustomShould
|
117
|
-
def matches?(other)
|
118
|
-
object == other.to_s
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def equal_string(str)
|
123
|
-
EqualString.new(str)
|
124
|
-
end
|
125
|
-
|
126
|
-
specify "should have to_s"
|
127
|
-
42.should equal_string("42")
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
Alternatively, your implementation can define
|
132
|
-
CustomShould#assumptions, where you can use test/spec assertions
|
133
|
-
instead of Boolean predicates:
|
134
|
-
|
135
|
-
class EqualString < Test::Spec::CustomShould
|
136
|
-
def assumptions(other)
|
137
|
-
object.should.equal other.to_s
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
A CustomShould by default takes one argument, which is placed in
|
142
|
-
self.object for your convenience.
|
143
|
-
|
144
|
-
You can CustomShould#failure_message to provide a better error
|
145
|
-
message.
|
146
|
-
|
147
|
-
|
148
|
-
== SpecDox and RDox
|
149
|
-
|
150
|
-
test/spec adds two additional test runners to Test::Unit, based on the
|
151
|
-
console runner but with a different output format.
|
152
|
-
|
153
|
-
SpecDox, run with <tt>--runner=specdox</tt> (or <tt>-rs</tt>) looks
|
154
|
-
like RSpec's output:
|
155
|
-
|
156
|
-
should.output
|
157
|
-
- works for print
|
158
|
-
- works for puts
|
159
|
-
- works with readline
|
160
|
-
|
161
|
-
RDox, run with <tt>--runner=rdox</tt> (or <tt>-rr</tt>) can be
|
162
|
-
included for RDoc documentation (e.g. see SPECS):
|
163
|
-
|
164
|
-
== should.output
|
165
|
-
* works for print
|
166
|
-
* works for puts
|
167
|
-
* works with readline
|
168
|
-
|
169
|
-
SpecDox and RDox work for Test::Unit too:
|
170
|
-
|
171
|
-
$ ruby -r test/spec test/testunit/test_testresult.rb -rs
|
172
|
-
|
173
|
-
Test::Unit::TC_TestResult
|
174
|
-
- fault notification
|
175
|
-
- passed?
|
176
|
-
- result changed notification
|
177
|
-
|
178
|
-
Finished in 0.106647 seconds.
|
179
|
-
|
180
|
-
3 specifications (30 requirements), 0 failures
|
181
|
-
|
182
|
-
|
183
|
-
== Disabled specifications
|
184
|
-
|
185
|
-
Akin to the usual Test::Unit practice, tests quickly can be disabled
|
186
|
-
by replacing +specify+ with +xspecify+. test/spec will count the
|
187
|
-
disabled tests when you run it with SpecDox or RDox.
|
188
|
-
|
189
|
-
|
190
|
-
== specrb
|
191
|
-
|
192
|
-
Since version 0.2, test/spec features a standalone test runner called
|
193
|
-
specrb. specrb is like an extended version of testrb, Test::Unit's
|
194
|
-
test runner, but has additional options. It can be used for
|
195
|
-
plain Test::Unit suites, too.
|
196
|
-
|
197
|
-
$ specrb -a -s -n should.output
|
198
|
-
|
199
|
-
should.output
|
200
|
-
- works for print
|
201
|
-
- works for puts
|
202
|
-
- works with readline
|
203
|
-
|
204
|
-
Finished in 0.162571 seconds.
|
205
|
-
|
206
|
-
3 specifications (6 requirements), 0 failures
|
207
|
-
|
208
|
-
Run <tt>specrb --help</tt> for the usage.
|
209
|
-
|
210
|
-
|
211
|
-
== Installing with RubyGems
|
212
|
-
|
213
|
-
Since version 0.3, a Gem of test/spec is available. You can install with:
|
214
|
-
|
215
|
-
gem install test-spec
|
216
|
-
|
217
|
-
I also provide a local mirror of the gems (and development snapshots)
|
218
|
-
at my site:
|
219
|
-
|
220
|
-
gem install test-spec --source http://chneukirchen.org/releases/gems
|
221
|
-
|
222
|
-
|
223
|
-
== History
|
224
|
-
|
225
|
-
* September 29th, 2006: First public release 0.1.
|
226
|
-
|
227
|
-
* October 18th, 2006: Second public release 0.2.
|
228
|
-
* Better, module-based implementation
|
229
|
-
* Official support for FlexMock and Mocha
|
230
|
-
* More robust Should#output
|
231
|
-
* Should#_operator_
|
232
|
-
* Nested contexts
|
233
|
-
* Standalone test/spec runner, specrb
|
234
|
-
|
235
|
-
* January 24th, 2007: Third public release 0.3.
|
236
|
-
* should.be_close, should.be_an_instance_of, should.be_a_kind_of,
|
237
|
-
and should.be_nil have been deprecated. Use the dot-variants of
|
238
|
-
them. These assertions will be removed in 1.0.
|
239
|
-
* specrb -a now includes -Ilib by default for easier out-of-the-box
|
240
|
-
testing.
|
241
|
-
* Added custom shoulds.
|
242
|
-
* Added messaging/blaming.
|
243
|
-
* Added disabling of specifications.
|
244
|
-
* Small bug fixes.
|
245
|
-
* Gem available.
|
246
|
-
|
247
|
-
|
248
|
-
== Contact
|
249
|
-
|
250
|
-
Please mail bugs, suggestions and patches to
|
251
|
-
<mailto:chneukirchen@gmail.com>.
|
252
|
-
|
253
|
-
Darcs repository ("darcs send" is welcome for patches):
|
254
|
-
http://chneukirchen.org/repos/testspec
|
255
|
-
|
256
|
-
|
257
|
-
== Thanks to
|
258
|
-
|
259
|
-
* Eero Saynatkari for writing <tt>should.output</tt>.
|
260
|
-
* Jean-Michel Garnier for packaging the first gem.
|
261
|
-
* Mikko Lehtonen for testing the gem.
|
262
|
-
* Thomas Fuchs for script.aculo.us BDD testing which convinced me.
|
263
|
-
* Dave Astels for BDD.
|
264
|
-
* The RSpec team for API inspiration.
|
265
|
-
* Nathaniel Talbott for Test::Unit.
|
266
|
-
|
267
|
-
|
268
|
-
== Copying
|
269
|
-
|
270
|
-
Copyright (C) 2006, 2007 Christian Neukirchen <http://purl.org/net/chneukirchen>
|
271
|
-
|
272
|
-
test/spec is licensed under the same terms as Ruby itself.
|
273
|
-
|
274
|
-
Please mail bugs, feature requests or patches to the mail addresses
|
275
|
-
found above or use IRC[irc://freenode.net/#ruby-lang] to contact the
|
276
|
-
developer.
|
277
|
-
|
278
|
-
|
279
|
-
== Links
|
280
|
-
|
281
|
-
Behavior-Driven Development:: <http://behaviour-driven.org/>
|
282
|
-
RSpec:: <http://rspec.rubyforge.org/>
|
283
|
-
script.aculo.us testing:: <http://mir.aculo.us/articles/2006/08/29/bdd-style-javascript-testing>
|
284
|
-
|
285
|
-
FlexMock:: <http://onestepback.org/software/flexmock/>
|
286
|
-
Mocha:: <http://mocha.rubyforge.org/>
|
287
|
-
|
288
|
-
Christian Neukirchen:: <http://chneukirchen.org/>
|
289
|
-
|