Class: Mini::Test::TestCase
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Assertions
#_assertions, #_assertions=, #assert, #assert_block, #assert_empty, #assert_equal, #assert_in_delta, #assert_in_epsilon, #assert_includes, #assert_instance_of, #assert_kind_of, #assert_match, #assert_nil, #assert_operator, #assert_raises, #assert_respond_to, #assert_same, #assert_throws, #capture_io, #exception_details, #fail, #message, #mu_pp, #pass, #refute, #refute_empty, #refute_equal, #refute_in_delta, #refute_in_epsilon, #refute_includes, #refute_instance_of, #refute_kind_of, #refute_match, #refute_nil, #refute_operator, #refute_respond_to, #refute_same
Constructor Details
#initialize(name) ⇒ TestCase
Returns a new instance of TestCase.
395
396
397
|
# File 'lib/mini/test.rb', line 395
def initialize name
@name = name
end
|
Instance Attribute Details
Returns the value of attribute name.
376
377
378
|
# File 'lib/mini/test.rb', line 376
def name
@name
end
|
Class Method Details
.inherited(klass) ⇒ Object
405
406
407
|
# File 'lib/mini/test.rb', line 405
def self.inherited klass
@@test_suites[klass] = true
end
|
399
400
401
|
# File 'lib/mini/test.rb', line 399
def self.reset
@@test_suites = {}
end
|
.test_methods ⇒ Object
417
418
419
420
421
422
423
424
425
426
427
428
|
# File 'lib/mini/test.rb', line 417
def self.test_methods
methods = public_instance_methods(true).grep(/^test/).map { |m|
m.to_s
}.sort
if self.test_order == :random then
max = methods.size
methods = methods.sort_by { rand(max) }
end
methods
end
|
.test_order ⇒ Object
409
410
411
|
# File 'lib/mini/test.rb', line 409
def self.test_order
:random
end
|
.test_suites ⇒ Object
413
414
415
|
# File 'lib/mini/test.rb', line 413
def self.test_suites
@@test_suites.keys.sort_by { |ts| ts.name }
end
|
Instance Method Details
#run(runner) ⇒ Object
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
# File 'lib/mini/test.rb', line 378
def run runner
result = '.'
begin
self.setup
self.__send__ self.name
rescue Exception => e
result = runner.puke(self.class, self.name, e)
ensure
begin
self.teardown
rescue Exception => e
result = runner.puke(self.class, self.name, e)
end
end
result
end
|
430
|
# File 'lib/mini/test.rb', line 430
def setup; end
|
431
|
# File 'lib/mini/test.rb', line 431
def teardown; end
|