mockserver-client-ruby/lib/mockserver/mock_server_client.rb
# Registers an expectation with the mockserver
# @param expectation [Expectation] the expectation to create the request from
# @return [Object] the response from the register action
Registers an expectation with the mockserver
Registers an expectation with the mockserver
def register(expectation)
      fail 'Expectation passed in is not valid type' unless expectation.is_a?(Expectation)
      request = create_expectation_request(expectation)
      logger.debug('Registering new expectation')
      logger.debug("URL: #{EXPECTATION_ENDPOINT} Payload: #{request.to_hash}")
      response = @base[EXPECTATION_ENDPOINT].put(request.to_json, content_type: :json)
      logger.debug("Got register response: #{response.code}")
      parse_string_to_json(response)
    end
def register ( expectation ) fail 'Expectation passed in is not valid type' unless expectation . is_a? ( Expectation ) request = create_expectation_request ( expectation ) logger . debug ( 'Registering new expectation' ) logger . debug ( "URL: #{EXPECTATION_ENDPOINT} Payload: #{request.to_hash}" ) response = @base [ EXPECTATION_ENDPOINT ] . put ( request . to_json , content_type : :json ) logger . debug ( "Got register response: #{response.code}" ) parse_string_to_json ( response ) end
Registers an expectation with the mockserver
Registers an expectation with the mockserver
the response from the register action
the response from the register action
Object
expectation
the expectation to create the request from
the expectation to create the request from