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.
Files changed (64) hide show
  1. data/CHANGELOG +6 -0
  2. data/Manifest.txt +55 -0
  3. data/Rakefile +32 -0
  4. data/init.rb +2 -0
  5. data/lib/microformat.rb +39 -6
  6. data/lib/mofo/hentry.rb +4 -0
  7. data/site/index.html +382 -0
  8. data/site/mofo-logo.png +0 -0
  9. data/site/mootools.v1.00.js +2 -0
  10. data/site/style.css +159 -0
  11. data/test/base_url_test.rb +22 -0
  12. data/test/fixtures/corkd.html +1 -1
  13. data/test/hatom_test.rb +1 -1
  14. data/test/hreview_test.rb +4 -3
  15. data/test/include_pattern_test.rb +1 -1
  16. data/test/test_helper.rb +17 -6
  17. metadata +63 -115
  18. data/test/format_test.rb +0 -230
  19. data/vendor/testspec-0.3.0/ChangeLog +0 -177
  20. data/vendor/testspec-0.3.0/README +0 -289
  21. data/vendor/testspec-0.3.0/ROADMAP +0 -1
  22. data/vendor/testspec-0.3.0/Rakefile +0 -151
  23. data/vendor/testspec-0.3.0/SPECS +0 -108
  24. data/vendor/testspec-0.3.0/TODO +0 -2
  25. data/vendor/testspec-0.3.0/bin/specrb +0 -104
  26. data/vendor/testspec-0.3.0/doc/classes/Kernel.html +0 -140
  27. data/vendor/testspec-0.3.0/doc/classes/Object.html +0 -155
  28. data/vendor/testspec-0.3.0/doc/classes/Test/Spec.html +0 -128
  29. data/vendor/testspec-0.3.0/doc/classes/Test/Spec/CustomShould.html +0 -236
  30. data/vendor/testspec-0.3.0/doc/classes/Test/Spec/DefinitionError.html +0 -111
  31. data/vendor/testspec-0.3.0/doc/classes/Test/Spec/Should.html +0 -884
  32. data/vendor/testspec-0.3.0/doc/classes/Test/Spec/ShouldNot.html +0 -487
  33. data/vendor/testspec-0.3.0/doc/classes/Test/Spec/TestCase.html +0 -220
  34. data/vendor/testspec-0.3.0/doc/classes/Test/Spec/TestCase/ClassMethods.html +0 -318
  35. data/vendor/testspec-0.3.0/doc/classes/Test/Spec/TestCase/InstanceMethods.html +0 -195
  36. data/vendor/testspec-0.3.0/doc/classes/Test/Unit/UI/RDox/TestRunner.html +0 -222
  37. data/vendor/testspec-0.3.0/doc/classes/Test/Unit/UI/SpecDox/TestRunner.html +0 -476
  38. data/vendor/testspec-0.3.0/doc/created.rid +0 -1
  39. data/vendor/testspec-0.3.0/doc/files/README.html +0 -516
  40. data/vendor/testspec-0.3.0/doc/files/ROADMAP.html +0 -109
  41. data/vendor/testspec-0.3.0/doc/files/SPECS.html +0 -386
  42. data/vendor/testspec-0.3.0/doc/files/lib/test/spec/dox_rb.html +0 -108
  43. data/vendor/testspec-0.3.0/doc/files/lib/test/spec/rdox_rb.html +0 -108
  44. data/vendor/testspec-0.3.0/doc/files/lib/test/spec/should-output_rb.html +0 -115
  45. data/vendor/testspec-0.3.0/doc/files/lib/test/spec_rb.html +0 -123
  46. data/vendor/testspec-0.3.0/doc/fr_class_index.html +0 -38
  47. data/vendor/testspec-0.3.0/doc/fr_file_index.html +0 -33
  48. data/vendor/testspec-0.3.0/doc/fr_method_index.html +0 -102
  49. data/vendor/testspec-0.3.0/doc/index.html +0 -24
  50. data/vendor/testspec-0.3.0/doc/rdoc-style.css +0 -208
  51. data/vendor/testspec-0.3.0/examples/stack.rb +0 -38
  52. data/vendor/testspec-0.3.0/examples/stack_spec.rb +0 -119
  53. data/vendor/testspec-0.3.0/lib/test/spec.rb +0 -490
  54. data/vendor/testspec-0.3.0/lib/test/spec/dox.rb +0 -122
  55. data/vendor/testspec-0.3.0/lib/test/spec/rdox.rb +0 -25
  56. data/vendor/testspec-0.3.0/lib/test/spec/should-output.rb +0 -49
  57. data/vendor/testspec-0.3.0/test/spec_dox.rb +0 -39
  58. data/vendor/testspec-0.3.0/test/spec_flexmock.rb +0 -210
  59. data/vendor/testspec-0.3.0/test/spec_mocha.rb +0 -118
  60. data/vendor/testspec-0.3.0/test/spec_nestedcontexts.rb +0 -26
  61. data/vendor/testspec-0.3.0/test/spec_should-output.rb +0 -26
  62. data/vendor/testspec-0.3.0/test/spec_testspec.rb +0 -522
  63. data/vendor/testspec-0.3.0/test/spec_testspec_order.rb +0 -26
  64. data/vendor/testspec-0.3.0/test/test_testunit.rb +0 -21
@@ -1,118 +0,0 @@
1
- # Adapted from mocha (http://mocha.rubyforge.org/).
2
- #
3
- # Copyright (C) 2006 Revieworld Ltd.
4
- #
5
- # You may use, copy and redistribute this library under the same terms
6
- # as Ruby itself (see www.ruby-lang.org/en/LICENSE.txt) or under the
7
- # MIT license (see MIT-LICENSE file).
8
-
9
- require 'test/spec'
10
-
11
- $: << "/home/chris/src/mocha-0.3.2/lib"
12
-
13
- begin
14
- require 'mocha'
15
- rescue LoadError
16
- context "mocha" do
17
- specify "can not be found. BAIL OUT!" do
18
- end
19
- end
20
- else
21
-
22
- context "mocha" do
23
- specify "works with test/spec" do
24
- object = mock()
25
- object.expects(:expected_method).with(:p1, :p2).returns(:result)
26
- object.expected_method(:p1, :p2).should.equal :result
27
- end
28
- end
29
-
30
- class Enterprise
31
- def initialize(dilithium)
32
- @dilithium = dilithium
33
- end
34
-
35
- def go(warp_factor)
36
- warp_factor.times { @dilithium.nuke(:anti_matter) }
37
- end
38
- end
39
-
40
- context "mocha" do
41
- specify "works with test/spec and Enterprise example" do
42
- dilithium = mock()
43
- dilithium.expects(:nuke).with(:anti_matter).at_least_once # auto-verified at end of test
44
- enterprise = Enterprise.new(dilithium)
45
- enterprise.go(2)
46
- end
47
- end
48
-
49
- end # if not rescue LoadError
50
-
51
-
52
- begin
53
- require 'stubba'
54
- rescue LoadError
55
- context "stubba" do
56
- specify "can not be found. BAIL OUT!" do
57
- end
58
- end
59
- else
60
-
61
- class Order
62
- attr_accessor :shipped_on
63
-
64
- def total_cost
65
- line_items.inject(0) { |total, line_item| total + line_item.price } + shipping_cost
66
- end
67
-
68
- def total_weight
69
- line_items.inject(0) { |total, line_item| total + line_item.weight }
70
- end
71
-
72
- def shipping_cost
73
- total_weight * 5 + 10
74
- end
75
-
76
- class << self
77
-
78
- def find_all
79
- # Database.connection.execute('select * from orders...
80
- end
81
-
82
- def number_shipped_since(date)
83
- find_all.select { |order| order.shipped_on > date }.size
84
- end
85
-
86
- def unshipped_value
87
- find_all.inject(0) { |total, order| order.shipped_on ? total : total + order.total_cost }
88
- end
89
-
90
- end
91
-
92
- end
93
-
94
- context "stubba" do
95
- specify "works with test/spec and instance method stubbing" do
96
- order = Order.new
97
- order.stubs(:total_weight).returns(10)
98
- order.shipping_cost.should.equal 60
99
- end
100
-
101
- specify "works with test/spec and class method stubbing" do
102
- now = Time.now; week_in_secs = 7 * 24 * 60 * 60
103
- order_1 = Order.new; order_1.shipped_on = now - 1 * week_in_secs
104
- order_2 = Order.new; order_2.shipped_on = now - 3 * week_in_secs
105
- Order.stubs(:find_all).returns([order_1, order_2])
106
- Order.number_shipped_since(now - 2 * week_in_secs).should.equal 1
107
- end
108
-
109
- specify "works with test/spec and global instance method stubbing" do
110
- Order.stubs(:find_all).returns([Order.new, Order.new, Order.new])
111
- Order.any_instance.stubs(:shipped_on).returns(nil)
112
- Order.any_instance.stubs(:total_cost).returns(10)
113
- Order.unshipped_value.should.equal 30
114
- end
115
- end
116
-
117
- end # if not rescue LoadError
118
-
@@ -1,26 +0,0 @@
1
- require 'test/spec'
2
-
3
- context "Empty context" do
4
- # should.not.raise
5
- end
6
-
7
- context "Outer context" do
8
- context "Inner context" do
9
- specify "is nested" do
10
- end
11
- specify "has multiple empty specifications" do
12
- end
13
- end
14
- context "Second Inner context" do
15
- context "Inmost context" do
16
- specify "works too!" do
17
- end
18
- specify "whoo!" do
19
- end
20
- end
21
- specify "is indented properly" do
22
- end
23
- specify "still runs in order of definition" do
24
- end
25
- end
26
- end
@@ -1,26 +0,0 @@
1
- $: << File.dirname(__FILE__) + '/../lib/'
2
- require 'test/spec'
3
- require 'test/spec/should-output'
4
-
5
- context "should.output" do
6
- specify "works for print" do
7
- lambda { print "foo" }.should.output "foo"
8
- lambda { print "foo" }.should.output(/oo/)
9
- end
10
-
11
- specify "works for puts" do
12
- lambda { puts "foo" }.should.output "foo\n"
13
- lambda { puts "foo" }.should.output(/foo/)
14
- end
15
-
16
- specify "works with readline" do
17
- lambda { require 'readline' }.should.not.raise(LoadError)
18
- lambda { puts "foo" }.should.output "foo\n"
19
- lambda { puts "foo" }.should.output(/foo/)
20
-
21
- File.should.not.exist(File.join(Dir.tmpdir, "should_output_#{$$}"))
22
- end
23
- end
24
-
25
-
26
-
@@ -1,522 +0,0 @@
1
- $: << File.dirname(__FILE__) + '/../lib/'
2
- require 'test/spec'
3
-
4
- $WARNING = ""
5
- class Object
6
- def warn(msg)
7
- $WARNING << msg.to_s
8
- super msg
9
- end
10
- end
11
-
12
- class Test::Spec::Should
13
- def _warn
14
- _wrap_assertion {
15
- begin
16
- old, $-w = $-w, nil
17
- $WARNING = ""
18
- self.not.raise
19
- $WARNING.should.blaming("no warning printed").not.be.empty
20
- ensure
21
- $-w = old
22
- end
23
- }
24
- end
25
- end
26
-
27
- # Hooray for meta-testing.
28
- module MetaTests
29
- class ShouldFail < Test::Spec::CustomShould
30
- def initialize
31
- end
32
-
33
- def assumptions(block)
34
- block.should.raise(Test::Unit::AssertionFailedError)
35
- end
36
-
37
- def failure_message
38
- "Block did not fail."
39
- end
40
- end
41
-
42
- class ShouldSucceed < Test::Spec::CustomShould
43
- def initialize
44
- end
45
-
46
- def assumptions(block)
47
- block.should.not.raise(Test::Unit::AssertionFailedError)
48
- end
49
-
50
- def failure_message
51
- "Block raised Test::Unit::AssertionFailedError."
52
- end
53
- end
54
-
55
- class ShouldBeDeprecated < Test::Spec::CustomShould
56
- def initialize
57
- end
58
-
59
- def assumptions(block)
60
- block.should._warn
61
- $WARNING.should =~ /deprecated/
62
- end
63
-
64
- def failure_message
65
- "warning was not a deprecation"
66
- end
67
- end
68
-
69
-
70
- def fail
71
- ShouldFail.new
72
- end
73
-
74
- def succeed
75
- ShouldSucceed.new
76
- end
77
-
78
- def deprecated
79
- ShouldBeDeprecated.new
80
- end
81
- end
82
-
83
- module TestShoulds
84
- class EmptyShould < Test::Spec::CustomShould
85
- end
86
-
87
- class EqualString < Test::Spec::CustomShould
88
- def matches?(other)
89
- object == other.to_s
90
- end
91
- end
92
-
93
- class EqualString2 < Test::Spec::CustomShould
94
- def matches?(other)
95
- object == other.to_s
96
- end
97
-
98
- def failure_message
99
- "yada yada yada"
100
- end
101
- end
102
-
103
- def empty_should(obj)
104
- EmptyShould.new(obj)
105
- end
106
-
107
- def equal_string(str)
108
- EqualString.new(str)
109
- end
110
-
111
- def equal_string2(str)
112
- EqualString2.new(str)
113
- end
114
- end
115
-
116
- context "test/spec" do
117
- include MetaTests
118
-
119
- specify "has should.satisfy" do
120
- lambda { should.satisfy { 1 == 1 } }.should succeed
121
- lambda { should.satisfy { 1 } }.should succeed
122
-
123
- lambda { should.satisfy { 1 == 2 } }.should fail
124
- lambda { should.satisfy { false } }.should fail
125
- lambda { should.satisfy { false } }.should fail
126
-
127
- lambda { 1.should.satisfy { |n| n % 2 == 0 } }.should fail
128
- lambda { 2.should.satisfy { |n| n % 2 == 0 } }.should succeed
129
- end
130
-
131
- specify "has should.equal" do
132
- lambda { "string1".should.equal "string1" }.should succeed
133
- lambda { "string1".should.equal "string2" }.should fail
134
- lambda { "1".should.equal 1 }.should fail
135
-
136
- lambda { "string1".should == "string1" }.should succeed
137
- lambda { "string1".should == "string2" }.should fail
138
- lambda { "1".should == 1 }.should fail
139
- end
140
-
141
- specify "has should.raise" do
142
- lambda { lambda { raise "Error" }.should.raise }.should succeed
143
- lambda { lambda { raise "Error" }.should.raise RuntimeError }.should succeed
144
- lambda { lambda { raise "Error" }.should.not.raise }.should fail
145
- lambda { lambda { raise "Error" }.should.not.raise(RuntimeError) }.should fail
146
-
147
- lambda { lambda { 1 + 1 }.should.raise }.should fail
148
- lambda { lambda { raise "Error" }.should.raise(Interrupt) }.should fail
149
- end
150
-
151
- specify "should.raise should return the exception" do
152
- ex = lambda { raise "foo!" }.should.raise
153
- ex.should.be.kind_of RuntimeError
154
- ex.message.should.match(/foo/)
155
- end
156
-
157
- specify "has should.be.an.instance_of" do
158
- lambda {
159
- lambda { "string".should.be_an_instance_of String }.should succeed
160
- }.should.be deprecated
161
- lambda {
162
- lambda { "string".should.be_an_instance_of Hash }.should fail
163
- }.should.be deprecated
164
-
165
- lambda { "string".should.be.instance_of String }.should succeed
166
- lambda { "string".should.be.instance_of Hash }.should fail
167
-
168
- lambda { "string".should.be.an.instance_of String }.should succeed
169
- lambda { "string".should.be.an.instance_of Hash }.should fail
170
- end
171
-
172
- specify "has should.be.nil" do
173
- lambda { nil.should.be.nil }.should succeed
174
- lambda { nil.should.be nil }.should succeed
175
- lambda { nil.should.be_nil }.should.be deprecated
176
-
177
- lambda { nil.should.not.be.nil }.should fail
178
- lambda { nil.should.not.be nil }.should fail
179
- lambda { lambda { nil.should.not.be_nil }.should fail }.should.be deprecated
180
-
181
- lambda { "foo".should.be.nil }.should fail
182
- lambda { "bar".should.be nil }.should fail
183
-
184
- lambda { "foo".should.not.be.nil }.should succeed
185
- lambda { "bar".should.not.be nil }.should succeed
186
- end
187
-
188
- specify "has should.include" do
189
- lambda { [1,2,3].should.include 2 }.should succeed
190
- lambda { [1,2,3].should.include 4 }.should fail
191
-
192
- lambda { {1=>2, 3=>4}.should.include 1 }.should succeed
193
- lambda { {1=>2, 3=>4}.should.include 2 }.should fail
194
- end
195
-
196
- specify "has should.be.a.kind_of" do
197
- lambda { Array.should.be.kind_of Module }.should succeed
198
- lambda { "string".should.be.kind_of Object }.should succeed
199
- lambda { 1.should.be.kind_of Comparable }.should succeed
200
-
201
- lambda { Array.should.be.a.kind_of Module }.should succeed
202
-
203
- lambda { "string".should.be.a.kind_of Class }.should fail
204
- lambda {
205
- lambda { "string".should.be_a_kind_of Class }.should fail
206
- }.should.be deprecated
207
-
208
- lambda { Array.should.be_a_kind_of Module }.should.be deprecated
209
- lambda { "string".should.be_a_kind_of Object }.should.be deprecated
210
- lambda { 1.should.be_a_kind_of Comparable }.should.be deprecated
211
- end
212
-
213
- specify "has should.match" do
214
- lambda { "string".should.match(/strin./) }.should succeed
215
- lambda { "string".should.match("strin") }.should succeed
216
- lambda { "string".should =~ /strin./ }.should succeed
217
- lambda { "string".should =~ "strin" }.should succeed
218
-
219
- lambda { "string".should.match(/slin./) }.should fail
220
- lambda { "string".should.match("slin") }.should fail
221
- lambda { "string".should =~ /slin./ }.should fail
222
- lambda { "string".should =~ "slin" }.should fail
223
- end
224
-
225
- specify "has should.be" do
226
- thing = "thing"
227
- lambda { thing.should.be thing }.should succeed
228
- lambda { thing.should.be "thing" }.should fail
229
-
230
- lambda { 1.should.be(2, 3) }.should.raise(ArgumentError)
231
- end
232
-
233
- specify "has should.not.raise" do
234
- lambda { lambda { 1 + 1 }.should.not.raise }.should succeed
235
- lambda { lambda { 1 + 1 }.should.not.raise(Interrupt) }.should succeed
236
-
237
- lambda {
238
- begin
239
- lambda {
240
- raise ZeroDivisionError.new("ArgumentError")
241
- }.should.not.raise(RuntimeError, StandardError, Comparable)
242
- rescue ZeroDivisionError
243
- end
244
- }.should succeed
245
-
246
- lambda { lambda { raise "Error" }.should.not.raise }.should fail
247
- end
248
-
249
- specify "has should.not.satisfy" do
250
- lambda { should.not.satisfy { 1 == 2 } }.should succeed
251
- lambda { should.not.satisfy { 1 == 1 } }.should fail
252
- end
253
-
254
- specify "has should.not.be" do
255
- thing = "thing"
256
- lambda { thing.should.not.be "thing" }.should succeed
257
- lambda { thing.should.not.be thing }.should fail
258
-
259
- lambda { thing.should.not.be thing, thing }.should.raise(ArgumentError)
260
- end
261
-
262
- specify "has should.not.equal" do
263
- lambda { "string1".should.not.equal "string2" }.should succeed
264
- lambda { "string1".should.not.equal "string1" }.should fail
265
- end
266
-
267
- specify "has should.not.match" do
268
- lambda { "string".should.not.match(/sling/) }.should succeed
269
- lambda { "string".should.not.match(/string/) }.should fail
270
- lambda { "string".should.not.match("strin") }.should fail
271
-
272
- lambda { "string".should.not =~ /sling/ }.should succeed
273
- lambda { "string".should.not =~ /string/ }.should fail
274
- lambda { "string".should.not =~ "strin" }.should fail
275
- end
276
-
277
- specify "has should.throw" do
278
- lambda { lambda { throw :thing }.should.throw(:thing) }.should succeed
279
-
280
- lambda { lambda { throw :thing2 }.should.throw(:thing) }.should fail
281
- lambda { lambda { 1 + 1 }.should.throw(:thing) }.should fail
282
- end
283
-
284
- specify "has should.not.throw" do
285
- lambda { lambda { 1 + 1 }.should.not.throw }.should succeed
286
- lambda { lambda { throw :thing }.should.not.throw }.should fail
287
- end
288
-
289
- specify "has should.respond_to" do
290
- lambda { "foo".should.respond_to :to_s }.should succeed
291
- lambda { 5.should.respond_to :to_str }.should fail
292
- lambda { :foo.should.respond_to :nx }.should fail
293
- end
294
-
295
- specify "has should.be_close" do
296
- lambda { 1.4.should.be.close 1.4, 0 }.should succeed
297
- lambda { 0.4.should.be.close 0.5, 0.1 }.should succeed
298
-
299
- lambda {
300
- lambda { 1.4.should.be_close 1.4, 0 }.should succeed
301
- }.should.be deprecated
302
- lambda {
303
- lambda { 0.4.should.be_close 0.5, 0.1 }.should succeed
304
- }.should.be deprecated
305
-
306
- lambda {
307
- float_thing = Object.new
308
- def float_thing.to_f
309
- 0.2
310
- end
311
- float_thing.should.be.close 0.1, 0.1
312
- }.should succeed
313
-
314
- lambda { 0.4.should.be.close 0.5, 0.05 }.should fail
315
- lambda { 0.4.should.be.close Object.new, 0.1 }.should fail
316
- lambda { 0.4.should.be.close 0.5, -0.1 }.should fail
317
- end
318
-
319
- specify "multiple negation works" do
320
- lambda { 1.should.equal 1 }.should succeed
321
- lambda { 1.should.not.equal 1 }.should fail
322
- lambda { 1.should.not.not.equal 1 }.should succeed
323
- lambda { 1.should.not.not.not.equal 1 }.should fail
324
-
325
- lambda { 1.should.equal 2 }.should fail
326
- lambda { 1.should.not.equal 2 }.should succeed
327
- lambda { 1.should.not.not.equal 2 }.should fail
328
- lambda { 1.should.not.not.not.equal 2 }.should succeed
329
- end
330
-
331
- specify "has should.<predicate>" do
332
- lambda { [].should.be.empty }.should succeed
333
- lambda { [1,2,3].should.not.be.empty }.should succeed
334
-
335
- lambda { [].should.not.be.empty }.should fail
336
- lambda { [1,2,3].should.be.empty }.should fail
337
-
338
- lambda { {1=>2, 3=>4}.should.has_key 1 }.should succeed
339
- lambda { {1=>2, 3=>4}.should.not.has_key 2 }.should succeed
340
-
341
- lambda { nil.should.bla }.should.raise(NoMethodError)
342
- lambda { nil.should.not.bla }.should.raise(NoMethodError)
343
- end
344
-
345
- specify "has should <operator> (>, >=, <, <=, ===)" do
346
- lambda { 2.should.be > 1 }.should succeed
347
- lambda { 1.should.be > 2 }.should fail
348
-
349
- lambda { 1.should.be < 2 }.should succeed
350
- lambda { 2.should.be < 1 }.should fail
351
-
352
- lambda { 2.should.be >= 1 }.should succeed
353
- lambda { 2.should.be >= 2 }.should succeed
354
- lambda { 2.should.be >= 2.1 }.should fail
355
-
356
- lambda { 2.should.be <= 1 }.should fail
357
- lambda { 2.should.be <= 2 }.should succeed
358
- lambda { 2.should.be <= 2.1 }.should succeed
359
-
360
- lambda { Array.should === [1,2,3] }.should succeed
361
- lambda { Integer.should === [1,2,3] }.should fail
362
-
363
- lambda { /foo/.should === "foobar" }.should succeed
364
- lambda { "foobar".should === /foo/ }.should fail
365
- end
366
-
367
- $contextscope = self
368
- specify "is robust against careless users" do
369
- lambda {
370
- $contextscope.specify
371
- }.should.raise(ArgumentError)
372
- lambda {
373
- $contextscope.specify "foo"
374
- }.should.raise(ArgumentError)
375
- lambda {
376
- Kernel.send(:context, "foo")
377
- }.should.raise(ArgumentError)
378
- lambda {
379
- context "foo" do
380
- end
381
- }.should.raise(Test::Spec::DefinitionError)
382
- end
383
-
384
- specify "should detect warnings" do
385
- lambda { lambda { 0 }.should._warn }.should fail
386
- lambda { lambda { warn "just a test" }.should._warn }.should succeed
387
- end
388
-
389
- specify "should message/blame faults" do
390
- begin
391
- 2.should.blaming("Two is not two anymore!").equal 3
392
- rescue Test::Unit::AssertionFailedError => e
393
- e.message.should =~ /Two/
394
- end
395
-
396
- begin
397
- 2.should.messaging("Two is not two anymore!").equal 3
398
- rescue Test::Unit::AssertionFailedError => e
399
- e.message.should =~ /Two/
400
- end
401
-
402
- begin
403
- 2.should.blaming("I thought two was three").not.equal 2
404
- rescue Test::Unit::AssertionFailedError => e
405
- e.message.should =~ /three/
406
- end
407
-
408
- begin
409
- 2.should.blaming("I thought two was three").not.not.not.equal 3
410
- rescue Test::Unit::AssertionFailedError => e
411
- e.message.should =~ /three/
412
- end
413
-
414
- lambda {
415
- lambda { raise "Error" }.should.messaging("Duh.").not.raise
416
- }.should.raise(Test::Unit::AssertionFailedError).message.should =~ /Duh/
417
- end
418
-
419
- include TestShoulds
420
- specify "should allow for custom shoulds" do
421
- lambda { (1+1).should equal_string("2") }.should succeed
422
- lambda { (1+2).should equal_string("2") }.should fail
423
-
424
- lambda { (1+1).should.pass equal_string("2") }.should succeed
425
- lambda { (1+2).should.pass equal_string("2") }.should fail
426
-
427
- lambda { (1+1).should.be equal_string("2") }.should succeed
428
- lambda { (1+2).should.be equal_string("2") }.should fail
429
-
430
- lambda { (1+1).should.not equal_string("2") }.should fail
431
- lambda { (1+2).should.not equal_string("2") }.should succeed
432
- lambda { (1+2).should.not.not equal_string("2") }.should fail
433
-
434
- lambda { (1+1).should.not.pass equal_string("2") }.should fail
435
- lambda { (1+2).should.not.pass equal_string("2") }.should succeed
436
-
437
- lambda { (1+1).should.not.be equal_string("2") }.should fail
438
- lambda { (1+2).should.not.be equal_string("2") }.should succeed
439
-
440
- lambda {
441
- (1+2).should equal_string("2")
442
- }.should.raise(Test::Unit::AssertionFailedError).message.should =~ /EqualString/
443
-
444
- lambda { (1+1).should equal_string2("2") }.should succeed
445
- lambda { (1+2).should equal_string2("2") }.should fail
446
-
447
- lambda {
448
- (1+2).should equal_string2("2")
449
- }.should.raise(Test::Unit::AssertionFailedError).message.should =~ /yada/
450
-
451
- lambda {
452
- (1+2).should.blaming("foo").pass equal_string2("2")
453
- }.should.raise(Test::Unit::AssertionFailedError).message.should =~ /foo/
454
-
455
- lambda {
456
- nil.should empty_should(nil)
457
- }.should.raise(NotImplementedError)
458
-
459
- lambda { nil.should :break, :now }.should.raise(ArgumentError)
460
- lambda { nil.should.not :pass, :now }.should.raise(ArgumentError)
461
- lambda { nil.should.not.not :break, :now }.should.raise(ArgumentError)
462
- end
463
-
464
- xspecify "disabled specification" do
465
- # just trying
466
- end
467
-
468
- context "more disabled" do
469
- xspecify "this is intentional" do
470
- # ...
471
- end
472
- end
473
- end
474
-
475
- context "setup/teardown" do
476
- setup do
477
- @a = 1
478
- @b = 2
479
- end
480
-
481
- setup do
482
- @a = 2
483
- end
484
-
485
- teardown do
486
- @a.should.equal 2
487
- @a = 3
488
- end
489
-
490
- teardown do
491
- @a.should.equal 3
492
- end
493
-
494
- specify "run in the right order" do
495
- @a.should.equal 2
496
- @b.should.equal 2
497
- end
498
- end
499
-
500
- module ContextHelper
501
- def foo
502
- 42
503
- end
504
- end
505
-
506
- context "contexts" do
507
- include ContextHelper
508
-
509
- FOO = 42
510
- $class = self.class
511
-
512
- specify "are defined in class scope" do
513
- lambda { FOO }.should.not.raise(NameError)
514
- FOO.should.equal 42
515
- $class.should.equal Class
516
- end
517
-
518
- specify "can include modules" do
519
- lambda { foo }.should.not.raise(NameError)
520
- foo.should.equal 42
521
- end
522
- end