Class: Most::TestCase
- Includes:
- MetaProgrammable, OptionsHelpers, PathHelpers, RunnerHelpers
- Defined in:
- lib/most/structures/test_case.rb
Instance Method Summary collapse
-
#initialize(name = 'Anonymous Test Case', input = '', output = '', output_destination = nil, output_preprocessor = lambda { |data| data.to_s().strip() }, runner = TestRunner.new(), &block) ⇒ TestCase
constructor
A new instance of TestCase.
- #run(options, entities) ⇒ Object
Methods included from RunnerHelpers
Methods included from OptionsHelpers
Methods included from PathHelpers
Methods included from MetaProgrammable
Constructor Details
#initialize(name = 'Anonymous Test Case', input = '', output = '', output_destination = nil, output_preprocessor = lambda { |data| data.to_s().strip() }, runner = TestRunner.new(), &block) ⇒ TestCase
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/most/structures/test_case.rb', line 43 def initialize(name = 'Anonymous Test Case', input = '', output = '', output_destination = nil, output_preprocessor = lambda { |data| data.to_s().strip() }, runner = TestRunner.new(), &block) @name = name @input = input @output = output @output_destination = output_destination @output_preprocessor = output_preprocessor @runner = runner 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
#run(options, entities) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/most/structures/test_case.rb', line 63 def run(, entities) SERVICES[:environment].state("#{2.w}Processing test case: #{@name}") result = Report.new("Test Case: #{@name}") if [:tests/:report/:specs] result.specs = {:name => @name, :correct_output => @output, :output_destination => @output_destination, :runner => @runner} end result << process(, entities) correct_status = result.last.last[:correct]; correct_status ||= false = "#{2.w}|--> Test case '#{@name}' correct?: #{correct_status}" SERVICES[:environment].() result end |