class Webspicy::Web::RackTestClient

Attributes

api[R]

Public Class Methods

for(app) click to toggle source
# File lib/webspicy/web/client/rack_test_client.rb, line 5
def self.for(app)
  Factory.new(app)
end
new(scope, app) click to toggle source
Calls superclass method Webspicy::Tester::Client::new
# File lib/webspicy/web/client/rack_test_client.rb, line 9
def initialize(scope, app)
  super(scope)
  @api = Api.new(scope, app)
end

Public Instance Methods

_call(test_case) click to toggle source
# File lib/webspicy/web/client/rack_test_client.rb, line 15
def _call(test_case)
  service, specification = test_case.service, test_case.specification

  # Instantiate the parameters
  headers = test_case.headers.dup
  params  = test_case.dress_params? ? service.dress_params(test_case.params) : test_case.params
  body    = test_case.body || test_case.located_file_upload

  # Instantiate the url and strip parameters
  url, params = specification.instantiate_url(params)
  url = scope.to_real_url(url, test_case){|u,_| u }

  # Invoke the service now
  api.public_send(service.method.to_s.downcase.to_sym, url, params, headers, body)

  # Return the last response
  api.last_response
end