Class: StepSequencer::Tests
- Inherits:
-
Object
- Object
- StepSequencer::Tests
- Defined in:
- lib/step_sequencer/tests.rb
Overview
A custom test runner. The tests themselves are in test_cases.rb Usage: StepSequencer::Tests.run The protected method run_test_collection can also be used; it’s more modular.
Defined Under Namespace
Modules: TestCaseHelpers Classes: TestCases
Class Method Summary collapse
-
.run ⇒ Object
Runs all the test cases, speaking the method name and playing the result.
-
.run_test_case(test_class, fn_name, test_case) ⇒ Object
shared ‘around’ hook for tests.
Class Method Details
.run ⇒ Object
Runs all the test cases, speaking the method name and playing the result.
Returns the results from the tests, for manual inspection from Pry
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/step_sequencer/tests.rb', line 16 def self.run cleanup run_test_collection(builder_tests) do |fn_name, test_case| result = run_test_case(builder_tests, fn_name, test_case) result.tap &method(:play_sounds) end run_test_collection(player_tests) do |fn_name, test_case| run_test_case(player_tests, fn_name, test_case) end end |
.run_test_case(test_class, fn_name, test_case) ⇒ Object
shared ‘around’ hook for tests
28 29 30 31 32 33 |
# File 'lib/step_sequencer/tests.rb', line 28 def self.run_test_case(test_class, fn_name, test_case) speak_fn_name fn_name puts fn_name test_class.method(fn_name).source.display test_case.call end |