Class: Webspicy::Web::RackTestClient
- Inherits:
-
Client
- Object
- Tester::Client
- Client
- Webspicy::Web::RackTestClient
- Defined in:
- lib/webspicy/web/client/rack_test_client.rb
Defined Under Namespace
Classes: Api, Factory, RackHandler
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Attributes inherited from Tester::Client
Class Method Summary collapse
Instance Method Summary collapse
- #_call(test_case) ⇒ Object
-
#initialize(scope, app) ⇒ RackTestClient
constructor
A new instance of RackTestClient.
Methods inherited from Client
Constructor Details
#initialize(scope, app) ⇒ RackTestClient
Returns a new instance of RackTestClient.
9 10 11 12 |
# File 'lib/webspicy/web/client/rack_test_client.rb', line 9 def initialize(scope, app) super(scope) @api = Api.new(scope, app) end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
13 14 15 |
# File 'lib/webspicy/web/client/rack_test_client.rb', line 13 def api @api end |
Class Method Details
.for(app) ⇒ Object
5 6 7 |
# File 'lib/webspicy/web/client/rack_test_client.rb', line 5 def self.for(app) Factory.new(app) end |
Instance Method Details
#_call(test_case) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 |