Class: RackStubs::PathSpecification

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

Instance Method Summary collapse

Constructor Details

#initialize(path, http_verb, rest_client) ⇒ PathSpecification

Returns a new instance of PathSpecification.



25
26
27
28
29
# File 'lib/rack_stubs/client.rb', line 25

def initialize(path, http_verb, rest_client)
  @path = path
  @http_verb = http_verb
  @rest_client = rest_client
end

Instance Method Details

#returns(status_code, response_headers, response_body) ⇒ Object



31
32
33
34
35
36
# File 'lib/rack_stubs/client.rb', line 31

def returns(status_code, response_headers, response_body)
  @rest_client.post(@path,
    { @http_verb => [status_code, response_headers, response_body] }.to_json,
    {"Content-Type" => "application/json+rack-stub"}
  )
end