Sha256: 103ceceba628a652596971d8226c77e65dc9bd042ef3719e1fc0a317ad2a6154

Contents?: true

Size: 807 Bytes

Versions: 57

Compression:

Stored size: 807 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

57 entries across 57 versions & 2 rubygems

Version Path
bullet-4.14.5 spec/support/rack_double.rb
bullet_instructure-4.0.5 spec/support/rack_double.rb
bullet-4.14.4 spec/support/rack_double.rb
bullet-4.14.3 spec/support/rack_double.rb
bullet-4.14.2 spec/support/rack_double.rb
bullet-4.14.0 spec/support/rack_double.rb
bullet-4.13.2 spec/support/rack_double.rb
bullet-4.13.1 spec/support/rack_double.rb
bullet_instructure-4.0.3 spec/support/rack_double.rb
bullet-4.13.0 spec/support/rack_double.rb
bullet-4.12.0 spec/support/rack_double.rb
bullet_instructure-4.0.2 spec/support/rack_double.rb
bullet-4.11.3 spec/support/rack_double.rb
bullet-4.11.2 spec/support/rack_double.rb
bullet-4.11.1 spec/support/rack_double.rb
bullet-4.11.0 spec/support/rack_double.rb
bullet-4.10.0 spec/support/rack_double.rb
bullet-4.9.0 spec/support/rack_double.rb
bullet-4.8.0 spec/support/rack_double.rb
bullet-4.7.1 spec/support/rack_double.rb