tests/email_api_tests.rb
# Builds a testable hash representing the expected response
Builds a testable hash representing the expected response
Builds a testable hash representing the expected response
def expected_response(response_code = 100, expected_data = {})
    client_response = ClientResponse.new
    expected_data.each do |key, value|
      val_hash = value.to_hash if value.respond_to?(:to_hash)
      client_response.email.send("#{key}=", val_hash.nil? ? value : val_hash)
    end
    if response_code == ok_code
      client_response.set_ok
    elsif response_code == bad_req_code
      client_response.set_bad_req
    elsif response_code == internal_err_code
      client_response.set_internal_err
    end
    client_response.to_hash
  end
def expected_response ( response_code = 100 , expected_data = { } ) client_response = ClientResponse . new expected_data . each do | key , value | val_hash = value . to_hash if value . respond_to? ( :to_hash ) client_response . email . send ( "#{key}=" , val_hash . nil? ? value : val_hash ) end if response_code == ok_code client_response . set_ok elsif response_code == bad_req_code client_response . set_bad_req elsif response_code == internal_err_code client_response . set_internal_err end client_response . to_hash end
Builds a testable hash representing the expected response
Builds a testable hash representing the expected response
# Assign email values # Determine if status is successful
response_code
<not_specific>
expected_data
<not_specific>