assay-minitest 0.1.0

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/.ruby ADDED
@@ -0,0 +1,52 @@
1
+ ---
2
+ source:
3
+ - meta
4
+ authors:
5
+ - name: Thomas Sawyer
6
+ email: transfire@gmail.com
7
+ copyrights:
8
+ - holder: Thomas Sawyer
9
+ year: '2012'
10
+ license: BSD-2-Clause
11
+ replacements: []
12
+ alternatives: []
13
+ requirements:
14
+ - name: assay
15
+ - name: detroit
16
+ groups:
17
+ - build
18
+ development: true
19
+ - name: qed
20
+ groups:
21
+ - test
22
+ development: true
23
+ dependencies: []
24
+ conflicts: []
25
+ repositories:
26
+ - uri: git@github.com:rubyworks/assay-minitest.git
27
+ scm: git
28
+ name: upstream
29
+ resources:
30
+ home: http://rubyworks.github.com/assay-minitest
31
+ docs: http://rubydoc.info/gems/assay-minitest
32
+ code: http://github.com/rubyworks/assay-minitest
33
+ mail: http://groups.google.com/groups/rubyworks-mailinglist
34
+ extra: {}
35
+ load_path:
36
+ - lib
37
+ revision: 0
38
+ created: '2012-01-18'
39
+ summary: MiniTest on Assay
40
+ title: Assay MiniTest
41
+ version: 0.1.0
42
+ name: assay-minitest
43
+ description: ! 'Assay MiniTest defines a set of MiniTest-compatible assertion and
44
+ extension
45
+
46
+ method which seemlessly delegate on Assay assertions. This allows developers
47
+
48
+ to change test frameworks without having to completely rewrite a slew of
49
+
50
+ previously written MiniTest-based tests and/or sepcifications.'
51
+ organization: Rubyworks
52
+ date: '2012-01-26'
@@ -0,0 +1,39 @@
1
+ = COPYRIGHT
2
+
3
+ == NOTICES
4
+
5
+ === Assay MiniTest
6
+
7
+ Copyright:: (c) 2012 RubyWorks
8
+ License:: (r) BSD-2-Clause
9
+ Website:: http://rubyworks.github.com/assay-minitest
10
+
11
+
12
+ == LICENSES
13
+
14
+ === BSD-2-Clause License
15
+
16
+ Assay MiniTest
17
+
18
+ Copyright (c) 2012 Rubyworks. All rights reserved.
19
+
20
+ Redistribution and use in source and binary forms, with or without
21
+ modification, are permitted provided that the following conditions are met:
22
+
23
+ 1. Redistributions of source code must retain the above copyright notice,
24
+ this list of conditions and the following disclaimer.
25
+
26
+ 2. Redistributions in binary form must reproduce the above copyright
27
+ notice, this list of conditions and the following disclaimer in the
28
+ documentation and/or other materials provided with the distribution.
29
+
30
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
31
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
32
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33
+ COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
35
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
37
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
39
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,12 @@
1
+ = HISTORY
2
+
3
+ == 0.1.0 | 2012-01-26
4
+
5
+ This is the initial release of Assay MiniTest. Compatibility
6
+ with MiniTest's assertion and expectation methods is nearly
7
+ complete.
8
+
9
+ Changes:
10
+
11
+ * Happy Birthday!
12
+
@@ -0,0 +1,75 @@
1
+ = Assay MiniTest
2
+
3
+ {Homepage}[http://rubyworks.github.com/assay-minitest] /
4
+ {Source Code}[http://github.com/rubyworks/assay-minitest] /
5
+ {MailingList}[http://groups.google.com/group/rubyworks-mailinglist]
6
+
7
+
8
+ == DESCRIPTION
9
+
10
+ Assay MiniTest is a compatability layer for using MiniTest's test or spec
11
+ assertion notations with the {Assay}[http://rubyworks.github.com/assay]
12
+ assertions framework.
13
+
14
+ Assay MiniTest defines a set of MiniTest-compatible assertion methods
15
+ which depend on Assay's assertion classes. This allows developers to
16
+ change test frameworks without having to change a slew of previously
17
+ defined assertions calls.
18
+
19
+ Assay defines assertions in the same way that Ruby defines exceptions.
20
+ An assertion is nothing more that an extended Exception class.
21
+ Assay provides a complete set of these assertion classes for all
22
+ common assertion needs. See {Assay}[http://rubyworks.github.com/assay]
23
+ project for more information on this foundational library.
24
+
25
+
26
+ == SYNOPSIS
27
+
28
+ Simply require the `assay/minitest` script, and include the `Assay::Matchers`
29
+ mixin module into your tests wherever your test framework requires it (which
30
+ may be as simple as the toplevel namespace).
31
+
32
+ require 'assay/minitest'
33
+
34
+ include Assay::Assertions
35
+
36
+ Now assertions can be made just as if you were using MiniTest.
37
+
38
+ assert_equal(10, 5+5)
39
+
40
+ refute_kind_of(String, 10)
41
+
42
+ Alternately, you can use MiniTest's expectations notation.
43
+
44
+ include Assay::Extensions
45
+
46
+ (5+5).must_equal(10)
47
+
48
+ 10.must_be_kind_of?(Fixnum)
49
+
50
+
51
+ == LIMITATIONS
52
+
53
+ Note that compatibility is not 100%, yet, though it is fairly close.
54
+ Compatibilty will improve with future releases. Please feel _obligated_
55
+ to submit a patch, if you need a missing a feature ;)
56
+
57
+
58
+ == INSTALLATION
59
+
60
+ To install with RubyGems simply open a console and type:
61
+
62
+ $ gem install assay-minitest
63
+
64
+ Site installation with the tarball can be done with Ruby Setup
65
+ (gem install setup). See http://rubyworks.github.com/setup.
66
+
67
+
68
+ == COPYRIGHTS
69
+
70
+ Copyright (c) 2012 Rubyworks
71
+
72
+ This program is ditributed under the terms of the *BSD-2-Clause* license.
73
+
74
+ See LICENSE.rdoc file for details.
75
+
@@ -0,0 +1,18 @@
1
+ require 'assay'
2
+
3
+ require_relative 'assay-minitest/assertions'
4
+ require_relative 'assay-minitest/extensions'
5
+
6
+ module Assay::Assertions
7
+ include Assay::MiniTest::Assertions
8
+ end
9
+
10
+ module Assay::Extensions
11
+ include Assay::MiniTest::Extensions
12
+ end
13
+
14
+ class Object
15
+ # should we be doing this here?
16
+ include Assay::Extensions
17
+ end
18
+
@@ -0,0 +1,52 @@
1
+ ---
2
+ source:
3
+ - meta
4
+ authors:
5
+ - name: Thomas Sawyer
6
+ email: transfire@gmail.com
7
+ copyrights:
8
+ - holder: Thomas Sawyer
9
+ year: '2012'
10
+ license: BSD-2-Clause
11
+ replacements: []
12
+ alternatives: []
13
+ requirements:
14
+ - name: assay
15
+ - name: detroit
16
+ groups:
17
+ - build
18
+ development: true
19
+ - name: qed
20
+ groups:
21
+ - test
22
+ development: true
23
+ dependencies: []
24
+ conflicts: []
25
+ repositories:
26
+ - uri: git@github.com:rubyworks/assay-minitest.git
27
+ scm: git
28
+ name: upstream
29
+ resources:
30
+ home: http://rubyworks.github.com/assay-minitest
31
+ docs: http://rubydoc.info/gems/assay-minitest
32
+ code: http://github.com/rubyworks/assay-minitest
33
+ mail: http://groups.google.com/groups/rubyworks-mailinglist
34
+ extra: {}
35
+ load_path:
36
+ - lib
37
+ revision: 0
38
+ created: '2012-01-18'
39
+ summary: MiniTest on Assay
40
+ title: Assay MiniTest
41
+ version: 0.1.0
42
+ name: assay-minitest
43
+ description: ! 'Assay MiniTest defines a set of MiniTest-compatible assertion and
44
+ extension
45
+
46
+ method which seemlessly delegate on Assay assertions. This allows developers
47
+
48
+ to change test frameworks without having to completely rewrite a slew of
49
+
50
+ previously written MiniTest-based tests and/or sepcifications.'
51
+ organization: Rubyworks
52
+ date: '2012-01-26'
@@ -0,0 +1,495 @@
1
+ module Assay; end
2
+ module Assay::MiniTest
3
+
4
+ # This module holds the MiniTest assertion methods for MiniTest
5
+ # compatibility.
6
+ #
7
+ # While it does not provide 100% of MiniTest's assertions at the moment,
8
+ # compatibility is very close and will improved with upcoming releases.
9
+ #
10
+ # TODO: Should we adjust error messages to be like MiniTests ?
11
+ #
12
+ module Assertions
13
+
14
+ #
15
+ def assert(truth, msg=nil)
16
+ Assertion.assert!(truth, :message=>msg)
17
+ end
18
+
19
+ #
20
+ def refute(untruth, msg=nil)
21
+ Assertion.refute!(untruth, :message=>msg)
22
+ end
23
+
24
+ #
25
+ #def assert_alias_method(object, alias_name, original_name, message = nil)
26
+ #end
27
+
28
+ #
29
+ # Passes if actual is like expected, where `like` means satisfyin any one
30
+ # of `#===`, `#==`, `#eql?` or `#equal?` calls.
31
+ #
32
+ # This is not strictly a Test::Unit assertion but is added here to cover
33
+ # all of Assay's availabe assertion classes.
34
+ #
35
+ def assert_alike(exp, act, msg=nil)
36
+ LikeAssay.assert!(act, exp, :message=>msg, :backtrace=>caller)
37
+ end
38
+
39
+ #
40
+ # Passes if actual is NOT like expected, where `like` means satisfyin any
41
+ # one of `#===`, `#==`, `#eql?` or `#equal?` calls.
42
+ #
43
+ def refute_alike(exp, act, msg=nil)
44
+ LikeAssay.refute!(act, exp, :message=>msg, :backtrace=>caller)
45
+ end
46
+
47
+ #
48
+ #
49
+ #
50
+ def assert_block(message="assert_block failed.", &block)
51
+ ExecutionAssay.assert!(:message=>message, &block)
52
+ end
53
+
54
+ #
55
+ # Passes if `boolean` is either `true` or `false`.
56
+ #
57
+ def assert_boolean(boolean, message=nil)
58
+ BooleanAssay.assert!(boolean, :message=>message)
59
+ end
60
+
61
+ #
62
+ # Passes if `boolean` is neither `true` or `false`.
63
+ #
64
+ def refute_boolean(boolean, message=nil)
65
+ BooleanAssay.refute!(boolean, :message=>message)
66
+ end
67
+
68
+ #
69
+ #def assert_const_defined(object, constant_name, message = nil)
70
+ #end
71
+ #
72
+ #def refute_const_defined(object, constant_name, message = nil)
73
+ #end
74
+
75
+ # Passes if object is empty.
76
+ #
77
+ # assert_empty(object)
78
+ #
79
+ def assert_empty(exp, msg=nil)
80
+ EmptyAssay.assert!(exp, :message=>msg, :backtrace=>caller)
81
+ end
82
+
83
+ # Passes if object is not empty.
84
+ #
85
+ # refute_empty(object)
86
+ #
87
+ def refute_empty(exp, msg=nil)
88
+ EmptyAssay.refute!(exp, :message=>msg, :backtrace=>caller)
89
+ end
90
+
91
+ # Passes if expected == +actual.
92
+ #
93
+ # Note that the ordering of arguments is important,
94
+ # since a helpful error message is generated when this
95
+ # one fails that tells you the values of expected and actual.
96
+ #
97
+ # assert_equal 'MY STRING', 'my string'.upcase
98
+ #
99
+ def assert_equal(exp, act, msg=nil)
100
+ EqualAssay.assert!(act, exp, :message=>msg, :backtrace=>caller)
101
+ end
102
+
103
+ # Passes if expected != actual
104
+ #
105
+ # refute_equal 'some string', 5
106
+ #
107
+ def refute_equal(exp, act, msg=nil)
108
+ EqualAssay.refute!(act, exp, :message=>msg, :backtrace=>caller)
109
+ end
110
+
111
+ #
112
+ #def assert_fail_assertion(message = nil)
113
+ #end
114
+
115
+ #
116
+ # Passed if object is +false+.
117
+ #
118
+ # assert_false(false)
119
+ #
120
+ def assert_false(exp, msg=nil)
121
+ FalseAssay.assert!(exp, :message=>msg, :backtrace=>caller)
122
+ end
123
+
124
+ #
125
+ # Passed if object is not +false+.
126
+ #
127
+ # refute_false(false)
128
+ #
129
+ def refute_false(exp, msg=nil)
130
+ FalseAssay.refute!(exp, :message=>msg, :backtrace=>caller)
131
+ end
132
+
133
+ #
134
+ # Passes if expected and actual are equal within delta tolerance.
135
+ #
136
+ # assert_in_delta 0.05, (50000.0 / 10**6), 0.00001
137
+ #
138
+ def assert_in_delta(exp, act, delta, msg=nil)
139
+ WithinAssay.assert!(act, exp, delta, :message=>msg, :backtrace=>caller)
140
+ end
141
+
142
+ #
143
+ # Passes if expected and actual are equal not within delta tolerance.
144
+ #
145
+ # refute_in_delta 0.05, (50000.0 / 10**6), 0.00001
146
+ #
147
+ def refute_in_delta(exp, act, delta, msg=nil)
148
+ WithinAssay.refute!(act, exp, delta, :message=>msg, :backtrace=>caller)
149
+ end
150
+
151
+ #
152
+ # Passes if `expected_float` and `actual_float` are within `epsilon`.
153
+ #
154
+ def assert_in_epsilon(exp, act, epsilon=0.001, message=nil)
155
+ delta = [exp, act].min * epsilon
156
+ WithinAssay.assert!(act, exp, delta, :message=>message, :backtrace=>caller)
157
+ end
158
+
159
+ #
160
+ # Passes if `expected_float` and `actual_float` are NOT within `epsilon`.
161
+ #
162
+ def refute_in_epsilon(exp, act, epsilon=0.001, message=nil)
163
+ delta = [exp, act].min * epsilon
164
+ WithinAssay.refute!(act, exp, delta, :message=>message, :backtrace=>caller)
165
+ end
166
+
167
+ #
168
+ # Passes if `collection` contains `member`.
169
+ #
170
+ def assert_includes(collection, member, message=nil)
171
+ IncludeAssay.assert!(collection, member, :message=>message, :backtrace=>caller)
172
+ end
173
+
174
+ #
175
+ # Passes if `collection` does not contain `member`.
176
+ #
177
+ def refute_includes(collection, member, message=nil)
178
+ IncludeAssay.refute!(collection, member, :message=>message, :backtrace=>caller)
179
+ end
180
+
181
+ #
182
+ # Passes if object is an instance of class.
183
+ #
184
+ # assert_instance_of(String, 'foo')
185
+ #
186
+ def assert_instance_of(cls, obj, msg=nil)
187
+ InstanceAssay.assert!(obj, cls, :message=>msg, :backtrace=>caller)
188
+ end
189
+
190
+ #
191
+ # Passes if object is not an instance of class.
192
+ #
193
+ # refute_instance_of(String, 500)
194
+ #
195
+ def refute_instance_of(cls, obj, msg=nil)
196
+ InstanceAssay.refute!(obj, cls, :message=>msg, :backtrace=>caller)
197
+ end
198
+
199
+ #
200
+ # Passes if object .kind_of? klass
201
+ #
202
+ # assert_kind_of(Object, 'foo')
203
+ #
204
+ def assert_kind_of(cls, obj, msg=nil)
205
+ KindAssay.assert!(obj, cls, :message=>msg, :backtrace=>caller)
206
+ end
207
+
208
+ #
209
+ # Passes if object .kind_of? klass
210
+ #
211
+ # refute_kind_of(Object, 'foo')
212
+ #
213
+ def refute_kind_of(cls, obj, msg=nil)
214
+ KindAssay.refute!(obj, cls, :message=>msg, :backtrace=>caller)
215
+ end
216
+
217
+ #
218
+ # Passes if object matches pattern using `#=~` method.
219
+ #
220
+ # assert_match(/\d+/, 'five, 6, seven')
221
+ #
222
+ def assert_match(pattern, string, msg=nil)
223
+ MatchAssay.assert!(string, pattern, :message=>msg, :backtrace=>caller)
224
+ end
225
+
226
+ #
227
+ # Passes if object does not match pattern using `#=~` method.
228
+ #
229
+ # assert_no_match(/two/, 'one 2 three')
230
+ #
231
+ def refute_match(pattern, string, msg=nil)
232
+ MatchAssay.refute!(string, pattern, :message=>msg, :backtrace=>caller)
233
+ end
234
+
235
+ #
236
+ # Passes if object does not match pattern using `#!~` method.
237
+ #
238
+ # assert_no_match(/two/, 'one 2 three')
239
+ #
240
+ def assert_no_match(pattern, string, msg=nil)
241
+ NoMatchAssay.assert!(string, pattern, :message=>msg, :backtrace=>caller)
242
+ end
243
+
244
+ #
245
+ # Passes if object is +nil+.
246
+ #
247
+ # assert_nil(nil)
248
+ #
249
+ def assert_nil(exp, msg=nil)
250
+ NilAssay.assert!(exp, :message=>msg, :backtrace=>caller)
251
+ end
252
+
253
+ #
254
+ # Passes if object is not +nil+.
255
+ #
256
+ # refute_nil(true)
257
+ #
258
+ def refute_nil(exp, msg=nil)
259
+ NilAssay.refute!(exp, :message=>msg, :backtrace=>caller)
260
+ end
261
+
262
+ #
263
+ # Passes if a block outputs matching test to `stdout` or `staderr`.
264
+ #
265
+ # This does not work _exactly_ like the original MiniTest assertion in
266
+ # that it is an *and* condition between the two stdout and stderr, whereas
267
+ # the original is and *or* condition.
268
+ #
269
+ # Note that this assertion translates into two separate underlying assertions,
270
+ # so counts for it may be double of what one might expect.
271
+ #
272
+ def assert_output(stdout=nil, stderr=nil, &block)
273
+ StdoutAssay.assert!(stdout, :backtrace=>caller, &block) if stdout
274
+ StderrAssay.assert!(stderr, :backtrace=>caller, &block) if stderr
275
+ end
276
+
277
+ #
278
+ # Passes if a block outputs matching test to `stdout` or `staderr`.
279
+ #
280
+ # This does not work _exactly_ like the original MiniTest assertion in
281
+ # that it is an *and* condition between the two stdout and stderr, whereas
282
+ # the original is and *or* condition.
283
+ #
284
+ # Note that this assertion translates into two separate underlying assertions,
285
+ # so counts for it may be double of what one might expect.
286
+ #
287
+ def refute_output(stdout=nil, stderr=nil, &block)
288
+ StdoutAssay.refute!(stdout, :backtrace=>caller, &block) if stdout
289
+ StderrAssay.refute!(stderr, :backtrace=>caller, &block) if stderr
290
+ end
291
+
292
+ #
293
+ # Like {#assert_output} but ensures no output.
294
+ #
295
+ def assert_silent(msg=nil, &block)
296
+ SilentAssay.assert!(:message=>msg, :backtrace=>caller, &block)
297
+ end
298
+
299
+ #
300
+ # Like {#refute_output} but ensures some output.
301
+ #
302
+ def refute_silent(msg=nil, &block)
303
+ SilentAssay.refute!(:message=>msg, :backtrace=>caller, &block)
304
+ end
305
+
306
+ #
307
+ # Passes it +predicate+ sent to object returns postively.
308
+ #
309
+ # assert_predicate(10, :even?)
310
+ #
311
+ def assert_predicate(object, predicate, message=nil)
312
+ ExecutionAssay.assert!(:message=>message, :backtrace=>caller) do
313
+ object.__send__(predicate)
314
+ end
315
+ end
316
+
317
+ #
318
+ # Passes it +predicate+ sent to object returns negatively.
319
+ #
320
+ # refute_predicate(10, :odd?)
321
+ #
322
+ def refute_predicate(object, predicate, message=nil)
323
+ ExecutionAssay.refute!(:message=>message, :backtrace=>caller) do
324
+ object.__send__(predicate)
325
+ end
326
+ end
327
+
328
+ #
329
+ # Passes if +object+ respond_to? +methods+.
330
+ #
331
+ # assert_respond_to 'bugbear', :slice
332
+ #
333
+ def assert_respond_to(reciever, method, msg=nil)
334
+ RespondAssay.assert!(reciever, method, :message=>msg, :backtrace=>caller)
335
+ end
336
+ alias_method :assert_responds_to, :assert_respond_to
337
+
338
+ #
339
+ # Passes if +object+ does not respond_to? +methods+.
340
+ #
341
+ # refute_respond_to 'bugbear', :slice
342
+ #
343
+ def refute_respond_to(reciever, method, msg=nil)
344
+ RespondAssay.refute!(reciever, method, :message=>msg, :backtrace=>caller)
345
+ end
346
+
347
+ #
348
+ # Passes if +expected+ .eql? +actual+.
349
+ #
350
+ # Note that the ordering of arguments is important,
351
+ # since a helpful error message is generated when this
352
+ # one fails that tells you the values of expected and actual.
353
+ #
354
+ # assert_equivalent 'MY STRING', 'my string'.upcase
355
+ #
356
+ def assert_equivalent(exp, act, msg=nil)
357
+ EqualityAssay.assert!(act, exp, :message=>msg, :backtrace=>caller)
358
+ end
359
+
360
+ #
361
+ # Passes if +criterion+ is NOT equivalent to +actual+ as tested using `#eql?`.
362
+ #
363
+ # refute_equivalent 'some string', 5
364
+ #
365
+ def refute_equivalent(criterion, act, msg=nil)
366
+ EqualityAssay.refute!(act, criterion, :message=>msg, :backtrace=>caller)
367
+ end
368
+
369
+ #
370
+ #
371
+ #
372
+ def assert_operator(receiver, operator, operand, message=nil)
373
+ ExecutionAssay.assert!(:message=>message, :backtrace=>caller) do
374
+ receiver.__send__(operator, operand)
375
+ end
376
+ end
377
+
378
+ #
379
+ #
380
+ #
381
+ def refute_operator(receiver, operator, operand, message=nil)
382
+ ExecutionAssay.refute!(:message=>message, :backtrace=>caller) do
383
+ receiver.__send__(operator, operand)
384
+ end
385
+ end
386
+
387
+ #
388
+ # Passes if the block raises given exception(s).
389
+ #
390
+ # assert_raises RuntimeError do
391
+ # raise 'Boom!!!'
392
+ # end
393
+ #
394
+ def assert_raises(*exceptions, &block)
395
+ msg = (Exception === exceptions.last ? exceptions.pop : nil)
396
+ RaiseAssay.assert!(*exceptions, :message=>msg, :backtrace=>caller, &block)
397
+ end
398
+
399
+ #
400
+ # Passes if the block *does not* raise given exception(s).
401
+ #
402
+ # refute_raises RuntimeError do
403
+ # raise 'Boom!!!'
404
+ # end
405
+ #
406
+ def refute_raises(*exceptions, &block)
407
+ msg = (Exception === exceptions.last ? exceptions.pop : nil)
408
+ RaiseAssay.refute!(*exceptions, :message=>msg, :backtrace=>caller, &block)
409
+ end
410
+
411
+ #
412
+ # Passes if the block yields successfully.
413
+ #
414
+ # refute_nothing_raised "Couldn't do the thing" do
415
+ # do_the_thing
416
+ # end
417
+ #
418
+ def assert_nothing_raised(msg=nil, &block)
419
+ RescueAssay.refute!(Exception, :message=>msg, :backtrace=>caller, &block)
420
+ end
421
+
422
+ #
423
+ # Passes if the block yields successfully.
424
+ #
425
+ # refute_nothing_raised "Couldn't do the thing" do
426
+ # do_the_thing
427
+ # end
428
+ #
429
+ def refute_nothing_raised(msg=nil, &block)
430
+ RescueAssay.assert!(Exception, :message=>msg, :backtrace=>caller, &block)
431
+ end
432
+
433
+ #
434
+ # Passes if actual is the same exact object as expected.
435
+ #
436
+ # assert_same(object, object)
437
+ #
438
+ def assert_same(exp, act, msg=nil)
439
+ IdentityAssay.assert!(act, exp, :message=>msg, :backtrace=>caller)
440
+ end
441
+
442
+ #
443
+ # Passes if actual is not the same exact object as expected.
444
+ #
445
+ # refute_same(object, other)
446
+ #
447
+ def refute_same(exp, act, msg=nil)
448
+ IdentityAssay.refute!(act, exp, :message=>msg, :backtrace=>caller)
449
+ end
450
+
451
+ #
452
+ #def assert_send(send_array, message=nil)
453
+ #end
454
+
455
+ #
456
+ # Passes if the block throws `expected` object.
457
+ #
458
+ # assert_throw :done do
459
+ # throw :done
460
+ # end
461
+ #
462
+ def assert_throws(expected, msg=nil, &blk)
463
+ ThrowAssay.assert!(expected, :message=>msg, :backtrace=>caller, &blk)
464
+ end
465
+
466
+ #
467
+ # Passes if the block does not throws `expected` object.
468
+ #
469
+ # refute_throws :done do
470
+ # throw :chimp
471
+ # end
472
+ #
473
+ def refute_throws(expected, msg=nil, &blk)
474
+ ThrowAssay.refute!(expected, :message=>msg, :backtrace=>caller, &blk)
475
+ end
476
+
477
+ #
478
+ # Passed if object is +true+.
479
+ #
480
+ def assert_true(exp, msg=nil)
481
+ TrueAssay.assert!(exp, :message=>msg, :backtrace=>caller)
482
+ end
483
+
484
+ #
485
+ # Passed if object is not +true+.
486
+ #
487
+ # refute_true(false)
488
+ #
489
+ def refute_true(exp, msg=nil)
490
+ TrueAssay.refute!(exp, :message=>msg, :backtrace=>caller)
491
+ end
492
+
493
+ end
494
+
495
+ end