class Object
Public Instance Methods
collect_errors(exchange)
click to toggle source
@param [Exchange, RestClient::Response] exchange Object
that returns Exchange
or is Exchange
@return [Array] List of errors when checking Exchange
response is successful
# File lib/soaspec/matchers.rb, line 102 def collect_errors(exchange) failure_list = [] failure_list << "#{exchange.status_code} not valid status code" unless exchange.successful_status_code? exchange.exchange_handler.expected_mandatory_elements.each do |mandatory_element_path| begin exchange[mandatory_element_path] rescue NoElementAtPath => e failure_list << e.message end end exchange.exchange_handler.expected_mandatory_xpath_values.each do |path, value| failure_list << "Expected value at xpath '#{path}' to be '#{value}' but was '#{exchange[path]}'" unless exchange[path] == value end exchange.exchange_handler.expected_mandatory_json_values.each do |path, value| failure_list << "Expected value at json '#{path}' to be '#{value}' but was '#{exchange[path]}'" unless exchange[path] == value end failure_list end
current_exchange()
click to toggle source
@return [Exchange] Return current or last exchange used in Cucumber
# File lib/soaspec/cucumber/generic_steps.rb, line 6 def current_exchange @current_exchange ||= Soaspec.last_exchange end