mofo 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/CHANGELOG +4 -0
  2. data/lib/microformat.rb +11 -1
  3. data/lib/microformat/simple.rb +21 -17
  4. data/lib/mofo/hentry.rb +1 -1
  5. data/lib/mofo/hreview.rb +0 -2
  6. data/lib/mofo/rel_tag.rb +0 -1
  7. data/tests/fixtures/bob.html +69 -0
  8. data/tests/fixtures/chowhound.html +1052 -0
  9. data/tests/fixtures/corkd.html +403 -0
  10. data/tests/fixtures/events.html +39 -0
  11. data/tests/fixtures/fake.html +1 -0
  12. data/tests/fixtures/fauxtank.html +535 -0
  13. data/tests/fixtures/hatom.html +1101 -0
  14. data/tests/fixtures/simple.html +5 -0
  15. data/tests/fixtures/upcoming.html +335 -0
  16. data/tests/format_test.rb +230 -0
  17. data/tests/hatom_test.rb +39 -0
  18. data/tests/test_helper.rb +6 -0
  19. data/tests/xoxo_test.rb +49 -0
  20. data/vendor/testspec-0.2.0/ChangeLog +120 -0
  21. data/vendor/testspec-0.2.0/README +206 -0
  22. data/vendor/testspec-0.2.0/ROADMAP +3 -0
  23. data/vendor/testspec-0.2.0/Rakefile +86 -0
  24. data/vendor/testspec-0.2.0/SPECS +101 -0
  25. data/vendor/testspec-0.2.0/TODO +1 -0
  26. data/vendor/testspec-0.2.0/bin/specrb +103 -0
  27. data/vendor/testspec-0.2.0/examples/stack.rb +38 -0
  28. data/vendor/testspec-0.2.0/examples/stack_spec.rb +119 -0
  29. data/vendor/testspec-0.2.0/lib/test/spec.rb +366 -0
  30. data/vendor/testspec-0.2.0/lib/test/spec/dox.rb +114 -0
  31. data/vendor/testspec-0.2.0/lib/test/spec/rdox.rb +25 -0
  32. data/vendor/testspec-0.2.0/lib/test/spec/should-output.rb +48 -0
  33. data/vendor/testspec-0.2.0/rdoc/classes/Kernel.html +105 -0
  34. data/vendor/testspec-0.2.0/rdoc/classes/Object.html +154 -0
  35. data/vendor/testspec-0.2.0/rdoc/classes/Test/Spec.html +132 -0
  36. data/vendor/testspec-0.2.0/rdoc/classes/Test/Spec/DefinitionError.html +111 -0
  37. data/vendor/testspec-0.2.0/rdoc/classes/Test/Spec/Should.html +863 -0
  38. data/vendor/testspec-0.2.0/rdoc/classes/Test/Spec/ShouldNot.html +411 -0
  39. data/vendor/testspec-0.2.0/rdoc/classes/Test/Spec/TestCase.html +220 -0
  40. data/vendor/testspec-0.2.0/rdoc/classes/Test/Spec/TestCase/ClassMethods.html +290 -0
  41. data/vendor/testspec-0.2.0/rdoc/classes/Test/Spec/TestCase/InstanceMethods.html +195 -0
  42. data/vendor/testspec-0.2.0/rdoc/classes/Test/Unit/UI/RDox/TestRunner.html +222 -0
  43. data/vendor/testspec-0.2.0/rdoc/classes/Test/Unit/UI/SpecDox/TestRunner.html +468 -0
  44. data/vendor/testspec-0.2.0/rdoc/created.rid +1 -0
  45. data/vendor/testspec-0.2.0/rdoc/files/README.html +409 -0
  46. data/vendor/testspec-0.2.0/rdoc/files/ROADMAP.html +112 -0
  47. data/vendor/testspec-0.2.0/rdoc/files/SPECS.html +365 -0
  48. data/vendor/testspec-0.2.0/rdoc/files/lib/test/spec/dox_rb.html +108 -0
  49. data/vendor/testspec-0.2.0/rdoc/files/lib/test/spec/rdox_rb.html +108 -0
  50. data/vendor/testspec-0.2.0/rdoc/files/lib/test/spec/should-output_rb.html +114 -0
  51. data/vendor/testspec-0.2.0/rdoc/files/lib/test/spec_rb.html +123 -0
  52. data/vendor/testspec-0.2.0/rdoc/fr_class_index.html +37 -0
  53. data/vendor/testspec-0.2.0/rdoc/fr_file_index.html +33 -0
  54. data/vendor/testspec-0.2.0/rdoc/fr_method_index.html +95 -0
  55. data/vendor/testspec-0.2.0/rdoc/index.html +24 -0
  56. data/vendor/testspec-0.2.0/rdoc/rdoc-style.css +208 -0
  57. data/vendor/testspec-0.2.0/test/spec_dox.rb +39 -0
  58. data/vendor/testspec-0.2.0/test/spec_flexmock.rb +210 -0
  59. data/vendor/testspec-0.2.0/test/spec_mocha.rb +118 -0
  60. data/vendor/testspec-0.2.0/test/spec_nestedcontexts.rb +26 -0
  61. data/vendor/testspec-0.2.0/test/spec_should-output.rb +26 -0
  62. data/vendor/testspec-0.2.0/test/spec_testspec.rb +311 -0
  63. data/vendor/testspec-0.2.0/test/spec_testspec_order.rb +26 -0
  64. data/vendor/testspec-0.2.0/test/test_testunit.rb +21 -0
  65. metadata +81 -2
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ RDoc Documentation
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>RDoc Documentation</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/README.html" name="docwin" />
23
+ </frameset>
24
+ </html>
@@ -0,0 +1,208 @@
1
+
2
+ body {
3
+ font-family: Verdana,Arial,Helvetica,sans-serif;
4
+ font-size: 90%;
5
+ margin: 0;
6
+ margin-left: 40px;
7
+ padding: 0;
8
+ background: white;
9
+ }
10
+
11
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
+ h1 { font-size: 150%; }
13
+ h2,h3,h4 { margin-top: 1em; }
14
+
15
+ a { background: #eef; color: #039; text-decoration: none; }
16
+ a:hover { background: #039; color: #eef; }
17
+
18
+ /* Override the base stylesheet's Anchor inside a table cell */
19
+ td > a {
20
+ background: transparent;
21
+ color: #039;
22
+ text-decoration: none;
23
+ }
24
+
25
+ /* and inside a section title */
26
+ .section-title > a {
27
+ background: transparent;
28
+ color: #eee;
29
+ text-decoration: none;
30
+ }
31
+
32
+ /* === Structural elements =================================== */
33
+
34
+ div#index {
35
+ margin: 0;
36
+ margin-left: -40px;
37
+ padding: 0;
38
+ font-size: 90%;
39
+ }
40
+
41
+
42
+ div#index a {
43
+ margin-left: 0.7em;
44
+ }
45
+
46
+ div#index .section-bar {
47
+ margin-left: 0px;
48
+ padding-left: 0.7em;
49
+ background: #ccc;
50
+ font-size: small;
51
+ }
52
+
53
+
54
+ div#classHeader, div#fileHeader {
55
+ width: auto;
56
+ color: white;
57
+ padding: 0.5em 1.5em 0.5em 1.5em;
58
+ margin: 0;
59
+ margin-left: -40px;
60
+ border-bottom: 3px solid #006;
61
+ }
62
+
63
+ div#classHeader a, div#fileHeader a {
64
+ background: inherit;
65
+ color: white;
66
+ }
67
+
68
+ div#classHeader td, div#fileHeader td {
69
+ background: inherit;
70
+ color: white;
71
+ }
72
+
73
+
74
+ div#fileHeader {
75
+ background: #057;
76
+ }
77
+
78
+ div#classHeader {
79
+ background: #048;
80
+ }
81
+
82
+
83
+ .class-name-in-header {
84
+ font-size: 180%;
85
+ font-weight: bold;
86
+ }
87
+
88
+
89
+ div#bodyContent {
90
+ padding: 0 1.5em 0 1.5em;
91
+ }
92
+
93
+ div#description {
94
+ padding: 0.5em 1.5em;
95
+ background: #efefef;
96
+ border: 1px dotted #999;
97
+ }
98
+
99
+ div#description h1,h2,h3,h4,h5,h6 {
100
+ color: #125;;
101
+ background: transparent;
102
+ }
103
+
104
+ div#validator-badges {
105
+ text-align: center;
106
+ }
107
+ div#validator-badges img { border: 0; }
108
+
109
+ div#copyright {
110
+ color: #333;
111
+ background: #efefef;
112
+ font: 0.75em sans-serif;
113
+ margin-top: 5em;
114
+ margin-bottom: 0;
115
+ padding: 0.5em 2em;
116
+ }
117
+
118
+
119
+ /* === Classes =================================== */
120
+
121
+ table.header-table {
122
+ color: white;
123
+ font-size: small;
124
+ }
125
+
126
+ .type-note {
127
+ font-size: small;
128
+ color: #DEDEDE;
129
+ }
130
+
131
+ .xxsection-bar {
132
+ background: #eee;
133
+ color: #333;
134
+ padding: 3px;
135
+ }
136
+
137
+ .section-bar {
138
+ color: #333;
139
+ border-bottom: 1px solid #999;
140
+ margin-left: -20px;
141
+ }
142
+
143
+
144
+ .section-title {
145
+ background: #79a;
146
+ color: #eee;
147
+ padding: 3px;
148
+ margin-top: 2em;
149
+ margin-left: -30px;
150
+ border: 1px solid #999;
151
+ }
152
+
153
+ .top-aligned-row { vertical-align: top }
154
+ .bottom-aligned-row { vertical-align: bottom }
155
+
156
+ /* --- Context section classes ----------------------- */
157
+
158
+ .context-row { }
159
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
+ .context-item-value { font-size: small; color: #448; }
161
+ .context-item-desc { color: #333; padding-left: 2em; }
162
+
163
+ /* --- Method classes -------------------------- */
164
+ .method-detail {
165
+ background: #efefef;
166
+ padding: 0;
167
+ margin-top: 0.5em;
168
+ margin-bottom: 1em;
169
+ border: 1px dotted #ccc;
170
+ }
171
+ .method-heading {
172
+ color: black;
173
+ background: #ccc;
174
+ border-bottom: 1px solid #666;
175
+ padding: 0.2em 0.5em 0 0.5em;
176
+ }
177
+ .method-signature { color: black; background: inherit; }
178
+ .method-name { font-weight: bold; }
179
+ .method-args { font-style: italic; }
180
+ .method-description { padding: 0 0.5em 0 0.5em; }
181
+
182
+ /* --- Source code sections -------------------- */
183
+
184
+ a.source-toggle { font-size: 90%; }
185
+ div.method-source-code {
186
+ background: #262626;
187
+ color: #ffdead;
188
+ margin: 1em;
189
+ padding: 0.5em;
190
+ border: 1px dashed #999;
191
+ overflow: hidden;
192
+ }
193
+
194
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
+
196
+ /* --- Ruby keyword styles --------------------- */
197
+
198
+ .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
+
200
+ .ruby-constant { color: #7fffd4; background: transparent; }
201
+ .ruby-keyword { color: #00ffff; background: transparent; }
202
+ .ruby-ivar { color: #eedd82; background: transparent; }
203
+ .ruby-operator { color: #00ffee; background: transparent; }
204
+ .ruby-identifier { color: #ffdead; background: transparent; }
205
+ .ruby-node { color: #ffa07a; background: transparent; }
206
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
+ .ruby-regexp { color: #ffa07a; background: transparent; }
208
+ .ruby-value { color: #7fffd4; background: transparent; }
@@ -0,0 +1,39 @@
1
+ require 'test/spec'
2
+
3
+ require 'test/spec/dox'
4
+
5
+ context "SpecDox" do
6
+ setup do
7
+ r = Test::Unit::UI::SpecDox::TestRunner.new(nil)
8
+ @unmangler = r.method(:unmangle)
9
+ end
10
+
11
+ specify "can unmangle Test::Unit names correctly" do
12
+ @unmangler["test_foo_bar(TestFoo)"].should.equal ["Foo", "foo bar"]
13
+ @unmangler["test_foo_bar(FooTest)"].should.equal ["Foo", "foo bar"]
14
+ @unmangler["test_he_he(Foo)"].should.equal ["Foo", "he he"]
15
+ @unmangler["test_heh(Foo)"].should.equal ["Foo", "heh"]
16
+
17
+ @unmangler["test_heh(Test::Unit::TC_Assertions)"].
18
+ should.equal ["Test::Unit::TC_Assertions", "heh"]
19
+
20
+ @unmangler["test_heh(Foo::Bar::Test)"].
21
+ should.equal ["Foo::Bar::Test", "heh"]
22
+ end
23
+
24
+ specify "can unmangle Test::Spec names correctly" do
25
+ @unmangler["test_spec {context} 007 [whee]()"].
26
+ should.equal ["context", "whee"]
27
+ @unmangler["test_spec {a bit longish context} 069 [and more text]()"].
28
+ should.equal ["a bit longish context", "and more text"]
29
+ @unmangler["test_spec {special chars !\"/&%$} 2 [special chars !\"/&%$]()"].
30
+ should.equal ["special chars !\"/&%$", "special chars !\"/&%$"]
31
+ @unmangler["test_spec {[]} 666666 [{}]()"].
32
+ should.equal ["[]", "{}"]
33
+ end
34
+
35
+ specify "has sensible fallbacks" do
36
+ @unmangler["weird"].should.equal [nil, nil]
37
+ end
38
+ end
39
+
@@ -0,0 +1,210 @@
1
+ # Adapted from flexmock (http://onestepback.org/software/flexmock).
2
+ #
3
+ # Copyright 2006 by Jim Weirich (jweirich@one.net).
4
+ # All rights reserved.
5
+
6
+ # Permission is granted for use, copying, modification, distribution,
7
+ # and distribution of modified versions of this work as long as the
8
+ # above copyright notice is included.
9
+
10
+
11
+ require 'test/spec'
12
+
13
+ begin
14
+ require 'flexmock'
15
+ rescue LoadError
16
+ context "flexmock" do
17
+ specify "can not be found. BAIL OUT!" do
18
+ end
19
+ end
20
+ else
21
+
22
+ context "flexmock" do
23
+ setup do
24
+ @mock = FlexMock.new
25
+ end
26
+
27
+ specify "should handle" do
28
+ args = nil
29
+ @mock.mock_handle(:hi) { |a, b| args = [a,b] }
30
+ @mock.hi(1,2)
31
+ args.should.equal [1,2]
32
+ end
33
+
34
+ specify "should handle without a block" do
35
+ lambda {
36
+ @mock.mock_handle(:blip)
37
+ @mock.blip
38
+ }.should.not.raise
39
+ end
40
+
41
+ specify "should handle with a block" do
42
+ called = false
43
+ @mock.mock_handle(:blip) { |block| block.call }
44
+ @mock.blip { called = true }
45
+ called.should.be true
46
+ end
47
+
48
+ specify "should have a return value" do
49
+ @mock.mock_handle(:blip) { 10 }
50
+ @mock.blip.should.equal 10
51
+ end
52
+
53
+ specify "should handle missing methods" do
54
+ ex = lambda {
55
+ @mock.not_defined
56
+ }.should.raise(NoMethodError)
57
+ ex.message.should.match(/not_defined/)
58
+ end
59
+
60
+ specify "should ignore missing methods" do
61
+ lambda {
62
+ @mock.mock_ignore_missing
63
+ @mock.blip
64
+ }.should.not.raise
65
+ end
66
+
67
+ specify "should count correctly" do
68
+ @mock.mock_handle(:blip, 3)
69
+ @mock.blip
70
+ @mock.blip
71
+ @mock.blip
72
+ @mock.mock_verify
73
+ end
74
+
75
+ specify "should raise on bad counts" do
76
+ @mock.mock_handle(:blip, 3)
77
+ @mock.blip
78
+ @mock.blip
79
+ lambda { @mock.mock_verify }.should.raise Test::Unit::AssertionFailedError
80
+ end
81
+
82
+ specify "should handle undetermined counts" do
83
+ FlexMock.use('fs') { |m|
84
+ m.mock_handle(:blip)
85
+ m.blip
86
+ m.blip
87
+ m.blip
88
+ }
89
+ end
90
+
91
+ specify "should handle zero counts" do
92
+ lambda {
93
+ FlexMock.use { |m|
94
+ m.mock_handle(:blip, 0)
95
+ m.blip
96
+ }
97
+ }.should.raise Test::Unit::AssertionFailedError
98
+ end
99
+
100
+ specify "should have file IO with use" do
101
+ file = FlexMock.use do |m|
102
+ filedata = ["line 1", "line 2"]
103
+ m.mock_handle(:gets, 3) { filedata.shift }
104
+ count_lines(m).should.equal 2
105
+ end
106
+ end
107
+
108
+ def count_lines(stream)
109
+ result = 0
110
+ while line = stream.gets
111
+ result += 1
112
+ end
113
+ result
114
+ end
115
+
116
+ specify "should have use" do
117
+ lambda {
118
+ FlexMock.use do |m|
119
+ m.mock_handle(:blip, 2)
120
+ m.blip
121
+ end
122
+ }.should.raise Test::Unit::AssertionFailedError
123
+ end
124
+
125
+ specify "should handle failures during use" do
126
+ ex = lambda {
127
+ FlexMock.use do |m|
128
+ m.mock_handle(:blip, 2)
129
+ xyz
130
+ end
131
+ }.should.raise NameError
132
+ ex.message.should.match(/undefined local variable or method/)
133
+ end
134
+
135
+ specify "should deal with sequential values" do
136
+ values = [1,4,9,16]
137
+ @mock.mock_handle(:get) { values.shift }
138
+ @mock.get.should.equal 1
139
+ @mock.get.should.equal 4
140
+ @mock.get.should.equal 9
141
+ @mock.get.should.equal 16
142
+ end
143
+
144
+ specify "respond_to? should return false for non handled methods" do
145
+ @mock.should.not.respond_to :blah
146
+ end
147
+
148
+ specify "respond_to? should return true for explicit methods" do
149
+ @mock.mock_handle(:xyz)
150
+ @mock.should.respond_to :xyz
151
+ end
152
+
153
+ specify "respond_to? should return true when ignoring_missing" do
154
+ @mock.mock_ignore_missing
155
+ @mock.should.respond_to :yada
156
+ end
157
+
158
+ specify "respond_to? should return true for missing_methods when should_ignore_missing" do
159
+ @mock.should_ignore_missing
160
+ @mock.should.respond_to :yada
161
+ end
162
+
163
+ specify "should raise error on unknown method proc" do
164
+ lambda {
165
+ @mock.method(:xyzzy)
166
+ }.should.raise NameError
167
+ end
168
+
169
+ specify "should return callable proc on method" do
170
+ got_it = false
171
+ @mock.mock_handle(:xyzzy) { got_it = true }
172
+ method_proc = @mock.method(:xyzzy)
173
+ method_proc.should.not.be.nil
174
+ method_proc.call
175
+ got_it.should.be true
176
+ end
177
+
178
+ specify "should return do nothing proc for missing methods" do
179
+ @mock.mock_ignore_missing
180
+ method_proc = @mock.method(:plugh)
181
+ method_proc.should.not.be.nil
182
+ lambda { method_proc.call }.should.not.raise
183
+ end
184
+ end
185
+
186
+
187
+ class TemperatureSampler
188
+ def initialize(sensor)
189
+ @sensor = sensor
190
+ end
191
+
192
+ def average_temp
193
+ total = (0...3).collect { @sensor.read_temperature }.inject { |i, s| i + s }
194
+ total / 3.0
195
+ end
196
+ end
197
+
198
+ context "flexmock" do
199
+ include FlexMock::TestCase
200
+
201
+ specify "works with test/spec" do
202
+ sensor = flexmock("temp")
203
+ sensor.should_receive(:read_temperature).times(3).and_return(10, 12, 14)
204
+
205
+ sampler = TemperatureSampler.new(sensor)
206
+ sampler.average_temp.should.equal 12
207
+ end
208
+ end
209
+
210
+ end # if not rescue LoadError