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
@@ -1,122 +0,0 @@
|
|
1
|
-
require 'test/unit/ui/console/testrunner'
|
2
|
-
|
3
|
-
module Test::Unit::UI # :nodoc:
|
4
|
-
module SpecDox # :nodoc:
|
5
|
-
class TestRunner < Test::Unit::UI::Console::TestRunner
|
6
|
-
protected
|
7
|
-
def setup_mediator
|
8
|
-
@mediator = create_mediator(@suite)
|
9
|
-
end
|
10
|
-
|
11
|
-
def add_fault(fault)
|
12
|
-
if fault.kind_of? Test::Spec::Disabled
|
13
|
-
@disabled += 1
|
14
|
-
output_no_nl " (disabled)"
|
15
|
-
else
|
16
|
-
@faults << fault
|
17
|
-
word = fault.class.name[/(.*::)?(.*)/, 2].upcase
|
18
|
-
output_no_nl " (#{word} - #{@faults.size})"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def started(result)
|
23
|
-
@result = result
|
24
|
-
@context = nil
|
25
|
-
@contexts = []
|
26
|
-
@disabled = 0
|
27
|
-
indent 0
|
28
|
-
end
|
29
|
-
|
30
|
-
def finished(elapsed_time)
|
31
|
-
nl
|
32
|
-
output "Finished in #{elapsed_time} seconds."
|
33
|
-
@faults.each_with_index do |fault, index|
|
34
|
-
nl
|
35
|
-
output("%3d) %s" % [index + 1, fault.long_display])
|
36
|
-
end
|
37
|
-
nl
|
38
|
-
output_result
|
39
|
-
end
|
40
|
-
|
41
|
-
def output_result
|
42
|
-
if @disabled > 0
|
43
|
-
disabled = ", #{@disabled} disabled"
|
44
|
-
else
|
45
|
-
disabled = ""
|
46
|
-
end
|
47
|
-
|
48
|
-
r = "%d specifications#{disabled} (%d requirements), %d failures" % [
|
49
|
-
@result.run_count, @result.assertion_count, @result.failure_count]
|
50
|
-
r << ", #{@result.error_count} errors" if @result.error_count > 0
|
51
|
-
output r
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_started(name)
|
55
|
-
contextname, specname = unmangle name
|
56
|
-
return if contextname.nil? || specname.nil?
|
57
|
-
|
58
|
-
if @context != contextname
|
59
|
-
@context = contextname
|
60
|
-
|
61
|
-
@old_contexts = @contexts
|
62
|
-
@contexts = @context.split("\t")
|
63
|
-
|
64
|
-
common = 0
|
65
|
-
@contexts.zip(@old_contexts) { |a, b|
|
66
|
-
break if a != b
|
67
|
-
common += 1
|
68
|
-
}
|
69
|
-
|
70
|
-
nl if common == 0
|
71
|
-
|
72
|
-
@contexts[common..-1].each_with_index { |head, i|
|
73
|
-
indent common + i
|
74
|
-
output_heading head
|
75
|
-
}
|
76
|
-
end
|
77
|
-
|
78
|
-
output_item specname
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_finished(name)
|
82
|
-
# Don't let empty contexts clutter up the output.
|
83
|
-
nl unless name =~ /\Adefault_test\(/
|
84
|
-
end
|
85
|
-
|
86
|
-
def output_no_nl(something, level=NORMAL)
|
87
|
-
@io.write(something) if (output?(level))
|
88
|
-
@io.flush
|
89
|
-
end
|
90
|
-
|
91
|
-
def output_item(item)
|
92
|
-
output_no_nl "#{@prefix}- #{item}"
|
93
|
-
end
|
94
|
-
|
95
|
-
def output_heading(heading)
|
96
|
-
output "#{@prefix}#{heading}"
|
97
|
-
end
|
98
|
-
|
99
|
-
def unmangle(name)
|
100
|
-
if name =~ /\Atest_spec \{(.*?)\} \d+ \[(.*)\]/
|
101
|
-
contextname = $1
|
102
|
-
specname = $2
|
103
|
-
elsif name =~ /test_(.*?)\((.*)\)$/
|
104
|
-
specname = $1
|
105
|
-
contextname = $2
|
106
|
-
|
107
|
-
contextname.gsub!(/^Test\B|\BTest$/, '')
|
108
|
-
specname.gsub!(/_/, ' ')
|
109
|
-
else
|
110
|
-
contextname = specname = nil
|
111
|
-
end
|
112
|
-
|
113
|
-
[contextname, specname]
|
114
|
-
end
|
115
|
-
|
116
|
-
def indent(depth)
|
117
|
-
@indent = depth
|
118
|
-
@prefix = " " * depth
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'test/spec/dox'
|
2
|
-
|
3
|
-
module Test::Unit::UI # :nodoc:
|
4
|
-
module RDox # :nodoc:
|
5
|
-
class TestRunner < Test::Unit::UI::SpecDox::TestRunner
|
6
|
-
def output_heading(heading)
|
7
|
-
output "#{@headprefix} #{heading}"
|
8
|
-
end
|
9
|
-
|
10
|
-
def output_item(item)
|
11
|
-
output_no_nl "* #{item}"
|
12
|
-
end
|
13
|
-
|
14
|
-
def finished(elapsed_time)
|
15
|
-
nl
|
16
|
-
output_result
|
17
|
-
end
|
18
|
-
|
19
|
-
def indent(depth)
|
20
|
-
@prefix = ""
|
21
|
-
@headprefix = "==" + "=" * depth
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# Code adapted from rs, written by Eero Saynatkari.
|
2
|
-
require 'fileutils'
|
3
|
-
require 'tmpdir'
|
4
|
-
|
5
|
-
class Test::Spec::Should
|
6
|
-
# Captures output from the IO given as
|
7
|
-
# the second argument (STDIN by default)
|
8
|
-
# and matches it against a String or
|
9
|
-
# Regexp given as the first argument.
|
10
|
-
def output(expected, to = STDOUT)
|
11
|
-
# Store the old stream
|
12
|
-
old_to = to.dup
|
13
|
-
|
14
|
-
# Obtain a filehandle to replace (works with Readline)
|
15
|
-
to.reopen File.open(File.join(Dir.tmpdir, "should_output_#{$$}"), "w+")
|
16
|
-
|
17
|
-
# Execute
|
18
|
-
@object.call
|
19
|
-
|
20
|
-
# Restore
|
21
|
-
out = to.dup
|
22
|
-
to.reopen old_to
|
23
|
-
|
24
|
-
# Grab the data
|
25
|
-
out.rewind
|
26
|
-
output = out.read
|
27
|
-
|
28
|
-
# Match up
|
29
|
-
case expected
|
30
|
-
when Regexp
|
31
|
-
output.should.match expected
|
32
|
-
else
|
33
|
-
output.should.equal expected
|
34
|
-
end # case expected
|
35
|
-
|
36
|
-
# Clean up
|
37
|
-
ensure
|
38
|
-
out.close
|
39
|
-
|
40
|
-
# STDIO redirection will break else
|
41
|
-
begin
|
42
|
-
to.seek 0, IO::SEEK_END
|
43
|
-
rescue Errno::ESPIPE
|
44
|
-
rescue Errno::EPIPE
|
45
|
-
end
|
46
|
-
|
47
|
-
FileUtils.rm_f out.path
|
48
|
-
end # output
|
49
|
-
end # Test::Spec::Should
|
@@ -1,39 +0,0 @@
|
|
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
|
-
|
@@ -1,210 +0,0 @@
|
|
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
|