Sha256: 90e22317fee86590375cedf684300c0fa70b5912e33e42d50867493e0d44313e

Contents?: true

Size: 716 Bytes

Versions: 22

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

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

22 entries across 22 versions & 1 rubygems

Version Path
bullet-7.0.7 spec/support/rack_double.rb
bullet-7.0.6 spec/support/rack_double.rb
bullet-7.0.5 spec/support/rack_double.rb
bullet-7.0.4 spec/support/rack_double.rb
bullet-7.0.3 spec/support/rack_double.rb
bullet-7.0.2 spec/support/rack_double.rb
bullet-7.0.1 spec/support/rack_double.rb
bullet-7.0.0 spec/support/rack_double.rb
bullet-6.1.5 spec/support/rack_double.rb
bullet-6.1.4 spec/support/rack_double.rb
bullet-6.1.3 spec/support/rack_double.rb
bullet-6.1.2 spec/support/rack_double.rb
bullet-6.1.1 spec/support/rack_double.rb
bullet-6.1.0 spec/support/rack_double.rb
bullet-6.0.2 spec/support/rack_double.rb
bullet-6.0.1 spec/support/rack_double.rb
bullet-6.0.0 spec/support/rack_double.rb
bullet-5.9.0 spec/support/rack_double.rb
bullet-5.8.1 spec/support/rack_double.rb
bullet-5.8.0 spec/support/rack_double.rb