Sha256: 7b83fd27dc3f9c706463b804d7966de8bd8b0b1097de95ff7bb1eb75f40584e3

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

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

    attr_writer :status

    attr_writer :headers

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

    attr_writer :response

    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

    attr_writer :body

    def each
      yield body
    end

    def close; end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bullet-5.7.4 spec/support/rack_double.rb
bullet-5.7.3 spec/support/rack_double.rb
bullet-5.7.2 spec/support/rack_double.rb
bullet-5.7.1 spec/support/rack_double.rb