Class: Sanford::TestRunner
- Inherits:
-
Object
- Object
- Sanford::TestRunner
- Includes:
- Runner::HaltMethods
- Defined in:
- lib/sanford/test_runner.rb
Defined Under Namespace
Modules: Helpers
Instance Attribute Summary collapse
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(handler_class, params = {}, logger = nil) ⇒ TestRunner
constructor
A new instance of TestRunner.
- #run ⇒ Object
Methods included from Runner::HaltMethods
Constructor Details
#initialize(handler_class, params = {}, logger = nil) ⇒ TestRunner
Returns a new instance of TestRunner.
13 14 15 16 17 18 19 20 |
# File 'lib/sanford/test_runner.rb', line 13 def initialize(handler_class, params = {}, logger = nil) @handler_class = handler_class @request = params.kind_of?(Sanford::Protocol::Request) ? params : test_request(params) @logger = logger || Sanford::NullLogger.new @handler = @handler_class.new(self) @response = build_response catch(:halt){ @handler.init; nil } end |
Instance Attribute Details
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
11 12 13 |
# File 'lib/sanford/test_runner.rb', line 11 def handler @handler end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
11 12 13 |
# File 'lib/sanford/test_runner.rb', line 11 def logger @logger end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
11 12 13 |
# File 'lib/sanford/test_runner.rb', line 11 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
11 12 13 |
# File 'lib/sanford/test_runner.rb', line 11 def response @response end |
Instance Method Details
#run ⇒ Object
22 23 24 |
# File 'lib/sanford/test_runner.rb', line 22 def run @response ||= build_response catch_halt{ @handler.run } end |