class Koine::RestClient::MockBuilder
mock builder
Public Class Methods
new(mock)
click to toggle source
# File lib/koine/rest_client/rspec_mock_client.rb, line 123 def initialize(mock) @mock = mock end
Public Instance Methods
on_error(&block)
click to toggle source
# File lib/koine/rest_client/rspec_mock_client.rb, line 143 def on_error(&block) @error_handler = block end
will_return(body: {}, code: 200) { |response| ... }
click to toggle source
# File lib/koine/rest_client/rspec_mock_client.rb, line 132 def will_return(body: {}, code: 200) response = MockResponse.new response.parsed_response = body response.code = code if block_given? response = yield(response) end @mock.and_return(response) self end
with(*args)
click to toggle source
# File lib/koine/rest_client/rspec_mock_client.rb, line 127 def with(*args) @mock.with(*args) self end