Class: MicroTest::TestMethod
- Inherits:
-
Object
- Object
- MicroTest::TestMethod
- Defined in:
- lib/microtest.rb
Overview
Encapsualtes test method for execution by RubyTest. Mainly this separate encapsulation allows the test description to be something other than just the method name, e.g. if the ‘MicroTest.natural_names` flag is set to true.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(testcase, method) ⇒ TestMethod
constructor
A new instance of TestMethod.
- #to_s ⇒ Object
Constructor Details
#initialize(testcase, method) ⇒ TestMethod
Returns a new instance of TestMethod.
89 90 91 92 |
# File 'lib/microtest.rb', line 89 def initialize(testcase, method) @testcase = testcase @method = method end |
Instance Method Details
#call ⇒ Object
94 95 96 97 98 |
# File 'lib/microtest.rb', line 94 def call @testcase.setup @method.call @testcase.teardown end |
#to_s ⇒ Object
100 101 102 103 104 |
# File 'lib/microtest.rb', line 100 def to_s name = @method.name.to_s name.gsub!('_', ' ') if MicroTest.natural_names return name end |