Class: RackDoubles::Stub

Inherits:
Object
  • Object
show all
Defined in:
lib/rack_doubles/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, http_client) ⇒ Stub

Returns a new instance of Stub.



82
83
84
85
# File 'lib/rack_doubles/client.rb', line 82

def initialize url, http_client
  @url = url
  @http_client = http_client
end

Instance Method Details

#to_return(status, headers, body) ⇒ Object



87
88
89
# File 'lib/rack_doubles/client.rb', line 87

def to_return status, headers, body
  @http_client.put(@url, [200, headers, [body]].to_json, { 'Content-Type' => 'application/json' })
end