Sha256: 475a0f0b7f01fac5fc09fadffbcbcdd1de050c9524c3141f3ebfa2ede0a88829

Contents?: true

Size: 808 Bytes

Versions: 1

Compression:

Stored size: 808 Bytes

Contents

module Support
  class AppDouble
    def call env
      env = @env
      [status, headers, response]
    end

    def status= status
      @status = status
    end

    def headers= headers
      @headers = headers
    end

    def headers
      @headers ||= { 'Content-Type' => 'text/html' }
      @headers
    end

    def response= response
      @response = response
    end

    private

    def status
      @status || 200
    end

    def response
      @response || ResponseDouble.new
    end
  end

  class ResponseDouble
    def initialize actual_body = nil
      @actual_body = actual_body
    end

    def body
      @body ||= '<html><head></head><body></body></html>'
    end

    def body= body
      @body = body
    end

    def each
      yield body
    end

    def close
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bullet-5.7.0 spec/support/rack_double.rb