Class: MockHTTP

Inherits:
Object
  • Object
show all
Defined in:
backend/spec/model_solr_spec.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) request

Returns the value of attribute request



24
25
26
# File 'backend/spec/model_solr_spec.rb', line 24

def request
  @request
end

Instance Method Details

- (Object) start(host, port, block)



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'backend/spec/model_solr_spec.rb', line 26

def start(host, port, block)
  http = Object.new

  def http.parent=(val)
      @parent = val
  end


  def http.request(req)
    @parent.request = req
    response = Object.new

    def response.body; $dummy_data; end
    def response.code; '200'; end

    response
  end

  http.parent = self

  block.call(http)
end