Module: Testicles
- Defined in:
- lib/testicles.rb,
lib/testicles/report.rb,
lib/testicles/runner.rb,
lib/testicles/test_case.rb,
lib/testicles/reports/progress.rb
Defined Under Namespace
Modules: Reports Classes: AssertionFailed, Pending, Report, Runner, TestCase
Class Method Summary collapse
-
.add_report(name, report) ⇒ Object
Register a new Report.
-
.add_test_case(test_case) ⇒ Object
Register a test case to be run with Testicles.
-
.autorun=(flag) ⇒ Object
Set to
falseto avoid running testsat_exit. -
.autorun? ⇒ Boolean
Checks to see if tests should be run
at_exitor not. -
.report_with(name) ⇒ Object
Select the name of the Report to use when running tests.
-
.run_all_tests!(*report_args) ⇒ Object
Run all registered test cases through the selected report.
Class Method Details
.add_report(name, report) ⇒ Object
Register a new Report. This will make your report available to Testicles, allowing you to run your tests through this report. For example
module Testicles
class Reports::MyAwesomeReport < Report
end
add_report :awesomesauce, MyAwesomeReport
end
See Testicles.report_with to see how to select which report will be used.
19 20 21 |
# File 'lib/testicles.rb', line 19 def self.add_report(name, report) available_reports[name] = report end |
.add_test_case(test_case) ⇒ Object
Register a test case to be run with Testicles. This is done automatically whenever you subclass Testicles::TestCase, so you probably shouldn’t pay much attention to this method.
26 27 28 |
# File 'lib/testicles.rb', line 26 def self.add_test_case(test_case) available_test_cases << test_case end |
.autorun=(flag) ⇒ Object
Set to false to avoid running tests at_exit. Default is true.
31 32 33 |
# File 'lib/testicles.rb', line 31 def self.autorun=(flag) @autorun = flag end |
.autorun? ⇒ Boolean
Checks to see if tests should be run at_exit or not. Default is true. See Testicles.autorun=
37 38 39 |
# File 'lib/testicles.rb', line 37 def self.autorun? !!@autorun end |
.report_with(name) ⇒ Object
Select the name of the Report to use when running tests. See Testicles.add_report for more information on registering a report.
The default report is Testicles::Reports::Progress
54 55 56 |
# File 'lib/testicles.rb', line 54 def self.report_with(name) @report = name end |
.run_all_tests!(*report_args) ⇒ Object
Run all registered test cases through the selected report. You can pass arguments to the Report constructor here.
See Testicles.add_test_case and Testicles.report_with
45 46 47 48 |
# File 'lib/testicles.rb', line 45 def self.run_all_tests!(*report_args) report = available_reports.fetch(@report).new(*report_args) Runner.new(report).run(*available_test_cases) end |