class MiniAssert::TestCase

Basic test case object

Attributes

passed_tests[R]
total_tests[R]

Public Class Methods

new() click to toggle source
# File lib/mini_assert/test_case.rb, line 10
def initialize
  @total_tests = testable_methods.size
  @passed_tests = 0
end

Public Instance Methods

each_test!() { |"#{file_name}:#{method_line} #{e}"| ... } click to toggle source
# File lib/mini_assert/test_case.rb, line 15
def each_test!
  testable_methods.each do |testable_method|
    begin
      public_send testable_method
      @passed_tests += 1
    rescue MiniAssert::AssertionError => e
      file_name, method_line = method(testable_method).source_location
      yield("#{file_name}:#{method_line} #{e}") if block_given?
    end
  end
end

Private Instance Methods

testable_methods() click to toggle source
# File lib/mini_assert/test_case.rb, line 29
def testable_methods
  @testable_methods ||= public_methods.select do |method_name|
    method_name.to_s =~ /test_.+/
  end.shuffle
end