Module: Webhookdb::SpecHelpers::Service::WebhookdbTestMethods
- Includes:
- Rack::Test::Methods
- Defined in:
- lib/webhookdb/spec_helpers/service.rb
Overview
Rack::Test overrides: Makes posts, puts, and patches JSON requests by default.
Instance Method Summary collapse
- #delete(uri, params = {}, env = {}) ⇒ Object
- #make_json_request(env, params) ⇒ Object
- #patch(uri, params = {}, env = {}) ⇒ Object
- #post(uri, params = {}, env = {}) ⇒ Object
- #put(uri, params = {}, env = {}) ⇒ Object
Instance Method Details
#delete(uri, params = {}, env = {}) ⇒ Object
426 427 428 429 |
# File 'lib/webhookdb/spec_helpers/service.rb', line 426 def delete(uri, params={}, env={}, &) env, params = make_json_request(env, params) super end |
#make_json_request(env, params) ⇒ Object
431 432 433 434 435 |
# File 'lib/webhookdb/spec_helpers/service.rb', line 431 def make_json_request(env, params) env["CONTENT_TYPE"] ||= "application/json" params = Webhookdb::Json.encode(params) if env["CONTENT_TYPE"] == "application/json" && !params.is_a?(String) return env, params end |
#patch(uri, params = {}, env = {}) ⇒ Object
421 422 423 424 |
# File 'lib/webhookdb/spec_helpers/service.rb', line 421 def patch(uri, params={}, env={}, &) env, params = make_json_request(env, params) super end |
#post(uri, params = {}, env = {}) ⇒ Object
411 412 413 414 |
# File 'lib/webhookdb/spec_helpers/service.rb', line 411 def post(uri, params={}, env={}, &) env, params = make_json_request(env, params) super end |
#put(uri, params = {}, env = {}) ⇒ Object
416 417 418 419 |
# File 'lib/webhookdb/spec_helpers/service.rb', line 416 def put(uri, params={}, env={}, &) env, params = make_json_request(env, params) super end |