lib/pipekit/webmock/api.rb in pipekit-webmock-0.4.2 vs lib/pipekit/webmock/api.rb in pipekit-webmock-0.4.3
- old
+ new
@@ -15,10 +15,11 @@
# response: {id: 123}
# )
# end
require "webmock"
require "pipekit/webmock/errors"
+require "pipekit/webmock/resource_name"
module Pipekit
module WebMock
module API
extend self
@@ -36,10 +37,11 @@
class StubRequest
include ::WebMock::API
def initialize(resource)
- @request = Pipekit::Request.new(resource)
+ resource_name = ResourceName.new(resource)
+ @request = Pipekit::Request.new(resource_name)
end
def stub_request_and_response(action, params, response)
request = self.send("stub_#{action}_request", params)
request.and_return(status: 200, body: {"data" => response, "success" => true}.to_json) if response