require File.expand_path(File.dirname(__FILE__) + '/../test_helper.rb') require File.expand_path(File.dirname(__FILE__) + '/../test_config.rb') class BaseModelTest < ActiveSupport::TestCase #helper methods def setup DatabaseCleaner.start end def teardown DatabaseCleaner.clean end def fake_response(code, body) net_http_resp = Net::HTTPResponse.new("1.1", code, "OK") net_http_resp.add_field 'Set-Cookie', 'Monster' RestClient::Response.create(body, net_http_resp, nil) end def get_error_message response_body JSON.parse(response_body.to_json)["messages"][0]["message"] unless response_body.nil? end def get_error_code response_body JSON.parse(response_body.to_json)["messages"][0]["code"] unless response_body.nil? end end