class Assert::Suite

This is the base suite. It loads the tests to run in memory and provides methods for these tests that the runner/view uses for handling and presentation purposes. It also stores suite-level setups and teardowns. Override the test/result count methods and the callbacks as needed. See the default suite for example usage.

Attributes

config[R]

A suite is a set of tests to run. When a test class subclasses the Context class, that test class is pushed to the suite.

end_time[RW]
setups[R]

A suite is a set of tests to run. When a test class subclasses the Context class, that test class is pushed to the suite.

start_time[RW]
teardowns[R]

A suite is a set of tests to run. When a test class subclasses the Context class, that test class is pushed to the suite.

Public Class Methods

new(config) click to toggle source
# File lib/assert/suite.rb, line 21
def initialize(config)
  @config     = config
  @tests      = []
  @setups     = []
  @teardowns  = []
  @start_time = Time.now
  @end_time   = @start_time
end

Public Instance Methods

after_load() click to toggle source
# File lib/assert/suite.rb, line 111
def after_load
end
after_test(test) click to toggle source
# File lib/assert/suite.rb, line 123
def after_test(test)
end
before_load(test_files) click to toggle source

define callback handlers to do special behavior during the test run. These will be called by the test runner.

# File lib/assert/suite.rb, line 102
def before_load(test_files)
end
before_test(test) click to toggle source
# File lib/assert/suite.rb, line 117
def before_test(test)
end
clear_tests_to_run() click to toggle source
# File lib/assert/suite.rb, line 52
def clear_tests_to_run
  @tests.clear
end
error_result_count() click to toggle source
# File lib/assert/suite.rb, line 76
def error_result_count
end
fail_result_count() click to toggle source
# File lib/assert/suite.rb, line 73
def fail_result_count
end
find_test_to_run(file_line) click to toggle source
# File lib/assert/suite.rb, line 56
def find_test_to_run(file_line)
  @tests.find{ |t| t.file_line == file_line }
end
ignore_result_count() click to toggle source
# File lib/assert/suite.rb, line 82
def ignore_result_count
end
inspect() click to toggle source
# File lib/assert/suite.rb, line 135
def inspect
  "#<#{self.class}:#{"0x0%x" % (object_id << 1)}"\
  " test_count=#{test_count.inspect}"\
  " result_count=#{result_count.inspect}>"
end
on_finish() click to toggle source
# File lib/assert/suite.rb, line 126
def on_finish
end
on_info(test) click to toggle source
# File lib/assert/suite.rb, line 129
def on_info(test)
end
on_interrupt(err) click to toggle source
# File lib/assert/suite.rb, line 132
def on_interrupt(err)
end
on_result(result) click to toggle source
# File lib/assert/suite.rb, line 120
def on_result(result)
end
on_start() click to toggle source
# File lib/assert/suite.rb, line 114
def on_start
end
on_test(test) click to toggle source

this is required to load tests into the suite, be sure to ‘super` if you override this method

# File lib/assert/suite.rb, line 107
def on_test(test)
  @tests << test
end
pass_result_count() click to toggle source
# File lib/assert/suite.rb, line 70
def pass_result_count
end
result_count() click to toggle source
# File lib/assert/suite.rb, line 67
def result_count
end
result_rate() click to toggle source
# File lib/assert/suite.rb, line 93
def result_rate
  get_rate(result_count, run_time)
end
run_time() click to toggle source
# File lib/assert/suite.rb, line 85
def run_time
  @end_time - @start_time
end
setup(&block) click to toggle source
# File lib/assert/suite.rb, line 34
def setup(&block)
  setups << (block || proc{})
end
Also aliased as: startup
shutdown(&block)
Alias for: teardown
skip_result_count() click to toggle source
# File lib/assert/suite.rb, line 79
def skip_result_count
end
sorted_tests_to_run(&sort_by_proc) click to toggle source
# File lib/assert/suite.rb, line 60
def sorted_tests_to_run(&sort_by_proc)
  @tests.sort.sort_by(&sort_by_proc)
end
startup(&block)
Alias for: setup
suite() click to toggle source
# File lib/assert/suite.rb, line 30
def suite
  self
end
teardown(&block) click to toggle source
# File lib/assert/suite.rb, line 39
def teardown(&block)
  teardowns << (block || proc{})
end
Also aliased as: shutdown
test_count() click to toggle source
# File lib/assert/suite.rb, line 64
def test_count
end
test_rate() click to toggle source
# File lib/assert/suite.rb, line 89
def test_rate
  get_rate(test_count, run_time)
end
tests_to_run?() click to toggle source
# File lib/assert/suite.rb, line 44
def tests_to_run?
  @tests.any?
end
tests_to_run_count() click to toggle source
# File lib/assert/suite.rb, line 48
def tests_to_run_count
  @tests.size
end