Sha256: cd52faf4a8650cb816cded2d0002526a58c519a47ede1f4593d413322495bd5a

Contents?: true

Size: 782 Bytes

Versions: 2

Compression:

Stored size: 782 Bytes

Contents

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

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
apl-library-0.0.90 test/unit/base_model_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/test/unit/base_model_test.rb