Class: Most::TestRunner
- Includes:
- MetaProgrammable, OptionsHelpers, PathHelpers
- Defined in:
- lib/most/structures/test_runner.rb
Instance Method Summary collapse
- #add_step(step, &block) ⇒ Object
-
#initialize(name = 'Anonymous Test Runner', steps = [], &block) ⇒ TestRunner
constructor
A new instance of TestRunner.
- #run(options, entities, input) ⇒ Object
Methods included from OptionsHelpers
Methods included from PathHelpers
Methods included from MetaProgrammable
Constructor Details
#initialize(name = 'Anonymous Test Runner', steps = [], &block) ⇒ TestRunner
Returns a new instance of TestRunner.
41 42 43 44 45 46 |
# File 'lib/most/structures/test_runner.rb', line 41 def initialize(name = 'Anonymous Test Runner', steps = [], &block) @name = name @steps = steps instance_eval(&block) if block_given? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MetaProgrammable
Instance Method Details
#add_step(step, &block) ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/most/structures/test_runner.rb', line 60 def add_step(step, &block) @steps ||= [] if step.is_a?(Class) and block_given? @steps << step.new(&block) else @steps << step end end |
#run(options, entities, input) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/most/structures/test_runner.rb', line 48 def run(, entities, input) result = Report.new("Test Runner: #{@name}") if [:tests/:report/:specs] result.specs = {:name => @name, :steps => @steps} end result << execute(, entities, input) result end |