Sha256: 89e88ed2d9b755e1f4ec8dcd911a0e7094f6de00de0547e3e28d08bbd464a09a

Contents?: true

Size: 781 Bytes

Versions: 2

Compression:

Stored size: 781 Bytes

Contents

require 'deas/runner'

module Deas

  class TestRunner < Runner

    attr_reader :handler, :return_value

    def initialize(handler_class, args = nil)
      args = (args || {}).dup
      @logger   = args.delete(:logger) || Deas::NullLogger.new
      @params   = args.delete(:params) || {}
      @request  = args.delete(:request)
      @response = args.delete(:response)
      @session  = args.delete(:session)

      super(handler_class)
      args.each{|key, value| @handler.send("#{key}=", value) }

      @return_value = catch(:halt){ @handler.init; nil }
    end

    def run
      @return_value ||= catch(:halt){ @handler.run }
    end

    # Helpers

    def halt(*args)
      throw(:halt, args)
    end

    def render(*args)
      "test runner render"
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deas-0.4.0 lib/deas/test_runner.rb
deas-0.3.0 lib/deas/test_runner.rb