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,39 @@
1
+ require 'tests/test_helper'
2
+ require 'mofo/hentry'
3
+
4
+ context "A parsed hEntry object" do
5
+ setup do
6
+ $hentry ||= HEntry.find(:first => fixture(:hatom))
7
+ end
8
+
9
+ specify "should have a title" do
10
+ $hentry.entry_title.should.equal "“A Rails Toolbox”"
11
+ end
12
+
13
+ specify "should have an author string " do
14
+ $hentry.author.should.be.an.instance_of HCard
15
+ $hentry.author.fn.should.equal "Chris"
16
+ end
17
+
18
+ specify "should have content" do
19
+ $hentry.entry_content.should.be.an.instance_of String
20
+ end
21
+
22
+ specify "should have an attached published date object" do
23
+ $hentry.published.should.be.an.instance_of Time
24
+ end
25
+
26
+ # TODO
27
+ # specify "should have an inferred updated attribute which references the published date object" do
28
+ # $hentry.updated.should.be.an.instance_of Time
29
+ # $hentry.updated.should.be $hentry.published
30
+ # end
31
+
32
+ specify "should have a bookmark (permalink)" do
33
+ $hentry.bookmark.should.equal "/post/13"
34
+ end
35
+
36
+ specify "should have an array of tags" do
37
+ $hentry.tags.should.be.an.instance_of Array
38
+ end
39
+ end
@@ -0,0 +1,6 @@
1
+ $:.unshift 'lib/'
2
+ require 'vendor/testspec-0.2.0/lib/test/spec'
3
+
4
+ def fixture(name)
5
+ File.dirname(__FILE__) + "/fixtures/#{name}.html"
6
+ end
@@ -0,0 +1,49 @@
1
+ require 'tests/test_helper'
2
+ require 'mofo/xoxo'
3
+
4
+ context "A simple xoxo object" do
5
+ setup do
6
+ @xoxo = XOXO.find(:text => '<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&#39;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>')
7
+ end
8
+
9
+ specify "should have five label elements" do
10
+ @xoxo.size.should.equal 5
11
+ classes = @xoxo.map { |x| x.class }.uniq
12
+ classes.size.should.equal 1
13
+ classes.first.should.equal XOXO::Label
14
+ end
15
+ end
16
+
17
+ context "A simple xoxo object with two nested LIs" do
18
+ setup do
19
+ @xoxo = XOXO.find(:text => '<ol> <li><p>Linkblogs</p> <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&#39;s Weblog</a></li> </ol> </li> <li><p>Weblogs</p> <ol> <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> </li> </ol>')
20
+ end
21
+
22
+ specify "should be a two element array of hashes" do
23
+ @xoxo.size.should.equal 2
24
+ end
25
+
26
+ specify "have hashes with two and three strings respectively" do
27
+ @xoxo.first.should.be.an.instance_of Hash
28
+ @xoxo.first["Linkblogs"].should.be.an.instance_of Array
29
+ @xoxo.first["Linkblogs"].size.should.be 2
30
+ @xoxo.last["Weblogs"].size.should.be 3
31
+ end
32
+ end
33
+
34
+ context "An array of xoxo objects created from a full webpage identified by class" do
35
+ setup do
36
+ @xoxo = XOXO.find(fixture(:chowhound), :class => true)
37
+ end
38
+
39
+ specify "should not be empty" do
40
+ @xoxo.size.should.be > 0
41
+ end
42
+
43
+ specify "should be four arrays of arrays" do
44
+ @xoxo.size.should.equal 4
45
+ @xoxo.map { |x| x.class }.uniq.first.should.equal Array
46
+ end
47
+ end
48
+
49
+ #' <ul id="ol1"> <li> Two <ul> <li>Sub 1</li> <li> Sub 2 <ul> <li>Sub C3</li> <li>Sub C4</li> </ul> </li> <li>Sub 3</li> <li>Sub 4</li> </ul> </li> <li>One</li> <li> Four <ul> <li>Sub D1</li> <li>Sub D2</li> <li> Sub D4 <ol> <li>Sub C1</li> <li>Sub C2</li> <li> Sub C3 <ul> <li>Sub B1</li> <li> Sub B2 <ul> <li>Sub B1</li> <li>Sub B3</li> <li>Sub B4</li> </ul> </li> <li>Sub B3</li> <li>Sub B4</li> </ul> </li> <li>Sub C4</li> </ol> </li> </ul> </li> <li> Three <ul> <li>Sub B1</li> <li>Sub B3</li> <li>Sub B4</li> </ul> </li> </ul> '
@@ -0,0 +1,120 @@
1
+ Wed Oct 18 18:21:06 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
2
+ tagged 0.2
3
+
4
+ Wed Oct 18 10:48:25 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
5
+ * Update documentation
6
+
7
+ Wed Oct 18 10:46:32 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
8
+ * Small alias tweak
9
+
10
+ Wed Oct 18 10:31:56 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
11
+ * Run specrb with "ruby", not the shell
12
+
13
+ Wed Oct 18 10:22:05 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
14
+ * Rescue seeking
15
+
16
+ Wed Oct 18 09:58:22 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
17
+ * Add roadmap
18
+
19
+ Sun Oct 15 23:47:07 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
20
+ * Simplify Rakefile
21
+
22
+ Sun Oct 15 23:46:16 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
23
+ * Fix should.output with redirection
24
+
25
+ Sun Oct 15 22:43:55 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
26
+ * Make rake use specrb
27
+
28
+ Sun Oct 15 22:34:31 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
29
+ * Add specrb, a standalone test/spec runner
30
+
31
+ Sun Oct 15 22:25:49 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
32
+ * A better fix for empty testcases
33
+
34
+ Sat Oct 14 17:08:23 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
35
+ * Make test/spec more robust
36
+
37
+ Sat Oct 14 16:42:08 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
38
+ * Implement nested contexts
39
+
40
+ Sat Oct 14 15:04:04 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
41
+ * Fix warnings
42
+
43
+ Sat Oct 14 14:59:52 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
44
+ * add should <operator> (>, >=, <, <=, ===)
45
+
46
+ Wed Oct 11 00:06:17 CEST 2006 Eero Saynatkari <projects@kittensoft.org>
47
+ * More robust Should#output
48
+ - Should#output uses IO#reopen and writes
49
+ directly to a file rather than bothering
50
+ with StringIO. This should enable catching
51
+ output from child processes etc. also.
52
+
53
+ Mon Oct 2 13:15:59 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
54
+ * Add mocha/stubba tests
55
+
56
+ Mon Oct 2 13:12:24 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
57
+ * Add flexmock tests
58
+
59
+ Mon Oct 2 13:11:37 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
60
+ * should.raise should return the exception
61
+
62
+ Mon Oct 2 13:11:17 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
63
+ * Refactor to modules
64
+
65
+ Fri Sep 29 20:24:42 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
66
+ * Fix warnings, enable -w for testing
67
+
68
+ Fri Sep 29 18:26:14 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
69
+ tagged 0.1
70
+
71
+ Fri Sep 29 18:20:34 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
72
+ * Last-minute fixes.
73
+
74
+ Fri Sep 29 17:59:57 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
75
+ * Fix SPECS generation
76
+
77
+ Fri Sep 29 17:36:34 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
78
+ * Add VERSION number
79
+
80
+ Fri Sep 29 17:35:47 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
81
+ * Polish it
82
+
83
+ Fri Sep 29 17:34:56 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
84
+ * Allow Object#should without specify-block
85
+
86
+ Fri Sep 29 17:03:36 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
87
+ * Add README
88
+
89
+ Fri Sep 29 17:01:31 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
90
+ * Test =~
91
+
92
+ Fri Sep 29 17:00:53 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
93
+ * Fix small mangling bug
94
+
95
+ Fri Sep 29 14:50:01 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
96
+ * Add RDox
97
+
98
+ Fri Sep 29 12:23:40 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
99
+ * Add more tests
100
+
101
+ Fri Sep 29 12:23:25 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
102
+ * Add SpecDox mangling for test/unit method names, too
103
+
104
+ Fri Sep 29 12:22:00 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
105
+ * Rearranging for rdoc
106
+
107
+ Fri Sep 29 12:20:10 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
108
+ * Fix rdoc task
109
+
110
+ Thu Sep 28 15:36:14 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
111
+ * Run contexts in order of appearance
112
+
113
+ Thu Sep 28 13:23:48 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
114
+ * Add and integrate RDox, TestDox-like output for RDoc
115
+
116
+ Wed Sep 27 21:37:54 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
117
+ * Integrate Rakefile
118
+
119
+ Wed Sep 27 21:37:11 CEST 2006 Christian Neukirchen <chneukirchen@gmail.com>
120
+ * Initial import of testspec
@@ -0,0 +1,206 @@
1
+ = test/spec, a BDD interface for Test::Unit
2
+
3
+ Copyright (C) 2006 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
+ == SpecDox and RDox
99
+
100
+ test/spec adds two additional test runners to Test::Unit, based on the
101
+ console runner but with a different output format.
102
+
103
+ SpecDox, run with <tt>--runner=specdox</tt> (or <tt>-rs</tt>) looks
104
+ like RSpec's output:
105
+
106
+ should.output
107
+ - works for print
108
+ - works for puts
109
+ - works with readline
110
+
111
+ RDox, run with <tt>--runner=rdox</tt> (or <tt>-rr</tt>) can be
112
+ included for RDoc documentation (e.g. see SPECS):
113
+
114
+ == should.output
115
+ * works for print
116
+ * works for puts
117
+ * works with readline
118
+
119
+ SpecDox and RDox work for Test::Unit too:
120
+
121
+ $ ruby -r test/spec test/testunit/test_testresult.rb -rs
122
+
123
+ Test::Unit::TC_TestResult
124
+ - fault notification
125
+ - passed?
126
+ - result changed notification
127
+
128
+ Finished in 0.106647 seconds.
129
+
130
+ 3 specifications (30 requirements), 0 failures
131
+
132
+
133
+ == specrb
134
+
135
+ Since version 0.2, test/spec features a standalone test runner called
136
+ specrb. specrb is like an extended version of testrb, Test::Unit's
137
+ test runner, but has additional options. It can be used for
138
+ plain Test::Unit suites, too.
139
+
140
+ $ specrb -a -s -n should.output
141
+
142
+ should.output
143
+ - works for print
144
+ - works for puts
145
+ - works with readline
146
+
147
+ Finished in 0.162571 seconds.
148
+
149
+ 3 specifications (6 requirements), 0 failures
150
+
151
+ Run <tt>specrb --help</tt> for the usage.
152
+
153
+
154
+ == History
155
+
156
+ * September 29th, 2006: First public release 0.1.
157
+
158
+ * October 18th, 2006: Second public release 0.2.
159
+ * Better, module-based implementation
160
+ * Official support for FlexMock and Mocha
161
+ * More robust Should#output
162
+ * Should#_operator_
163
+ * Nested contexts
164
+ * Standalone test/spec runner, specrb
165
+
166
+
167
+ == Contact
168
+
169
+ Please mail bugs, suggestions and patches to
170
+ <mailto:chneukirchen@gmail.com>.
171
+
172
+ Darcs repository ("darcs send" is welcome for patches):
173
+ http://chneukirchen.org/repos/testspec
174
+
175
+
176
+ == Thanks to
177
+
178
+ * Eero Saynatkari for writing <tt>should.output</tt>.
179
+ * Thomas Fuchs for script.aculo.us BDD testing which convinced me.
180
+ * Dave Astels for BDD.
181
+ * The RSpec team for API inspiration.
182
+ * Nathaniel Talbott for Test::Unit.
183
+
184
+
185
+ == Copying
186
+
187
+ Copyright (C) 2006 Christian Neukirchen <http://purl.org/net/chneukirchen>
188
+
189
+ test/spec is licensed under the same terms as Ruby itself.
190
+
191
+ Please mail bugs, feature requests or patches to the mail addresses
192
+ found above or use IRC[irc://freenode.net/#ruby-lang] to contact the
193
+ developer.
194
+
195
+
196
+ == Links
197
+
198
+ Behavior-Driven Development:: <http://behaviour-driven.org/>
199
+ RSpec:: <http://rspec.rubyforge.org/>
200
+ script.aculo.us testing:: <http://mir.aculo.us/articles/2006/08/29/bdd-style-javascript-testing>
201
+
202
+ FlexMock:: <http://onestepback.org/software/flexmock/>
203
+ Mocha:: <http://mocha.rubyforge.org/>
204
+
205
+ Christian Neukirchen:: <http://chneukirchen.org/>
206
+
@@ -0,0 +1,3 @@
1
+ Version 0.3 (November 2006):: deprecate underscore forms.
2
+
3
+ Version 1.0 (Late November 2006):: first stable release.
@@ -0,0 +1,86 @@
1
+ # Rakefile for testspec. -*-ruby-*-
2
+ require 'rake/rdoctask'
3
+ require 'rake/testtask'
4
+
5
+
6
+ desc "Run all the tests"
7
+ task :default => [:test]
8
+
9
+ desc "Do predistribution stuff"
10
+ task :predist => [:chmod, :changelog, :rdoc]
11
+
12
+
13
+ desc "Run all the tests"
14
+ task :test => :chmod do
15
+ ruby "bin/specrb -Ilib:test -w #{ENV['TEST'] || '-a'} #{ENV['TESTOPTS']}"
16
+ end
17
+
18
+ desc "Make an archive as .tar.gz"
19
+ task :dist => :test do
20
+ system "export DARCS_REPO=#{File.expand_path "."}; " +
21
+ "darcs dist -d testspec#{get_darcs_tree_version}"
22
+ end
23
+
24
+ desc "Make binaries executable"
25
+ task :chmod do
26
+ Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
27
+ end
28
+
29
+ desc "Generate a ChangeLog"
30
+ task :changelog do
31
+ system "darcs changes --repo=#{ENV["DARCS_REPO"] || "."} >ChangeLog"
32
+ end
33
+
34
+ desc "Generate RDoc documentation"
35
+ Rake::RDocTask.new(:rdoc) do |rdoc|
36
+ rdoc.options << '--line-numbers' << '--inline-source'
37
+ rdoc.rdoc_dir = "rdoc"
38
+ rdoc.rdoc_files.include 'README'
39
+ rdoc.rdoc_files.include 'ROADMAP'
40
+ rdoc.rdoc_files.include 'SPECS'
41
+ rdoc.rdoc_files.include('lib/**/*.rb')
42
+ end
43
+ task :rdoc => "SPECS"
44
+
45
+ desc "Generate RDox"
46
+ task "SPECS" do
47
+ ruby "bin/specrb -Ilib:test -a --rdox >SPECS"
48
+ end
49
+
50
+ begin
51
+ require 'rcov/rcovtask'
52
+
53
+ Rcov::RcovTask.new do |t|
54
+ t.test_files = FileList['test/spec_*.rb'] + ['--', '-rs'] # evil
55
+ t.verbose = true # uncomment to see the executed command
56
+ t.rcov_opts = ["--text-report", "--include-file", "^lib\\|^test"]
57
+ end
58
+ rescue LoadError
59
+ end
60
+
61
+
62
+ # Helper to retrieve the "revision number" of the darcs tree.
63
+ def get_darcs_tree_version
64
+ return "" unless File.directory? "_darcs"
65
+
66
+ changes = `darcs changes`
67
+ count = 0
68
+ tag = "0.0"
69
+
70
+ changes.each("\n\n") { |change|
71
+ head, title, desc = change.split("\n", 3)
72
+
73
+ if title =~ /^ \*/
74
+ # Normal change.
75
+ count += 1
76
+ elsif title =~ /tagged (.*)/
77
+ # Tag. We look for these.
78
+ tag = $1
79
+ break
80
+ else
81
+ warn "Unparsable change: #{change}"
82
+ end
83
+ }
84
+
85
+ "-" + tag + "." + count.to_s
86
+ end