Sha256: 31d6bf5abac6043d7a046d1c793b0b290b264b1641eeb070795e90879b08de5c

Contents?: true

Size: 1.02 KB

Versions: 19

Compression:

Stored size: 1.02 KB

Contents

require 'checkr'
require 'test/unit'
require 'mocha/setup'
require 'stringio'
require 'shoulda'
require File.expand_path('../test_data', __FILE__)
require File.expand_path('../mock_resource', __FILE__)

# monkeypatch request methods
module Checkr
  @mock_rest_client = nil

  def self.mock_rest_client=(mock_client)
    @mock_rest_client = mock_client
  end

  def self.execute_request(opts)
    headers = opts[:headers]
    post_params = opts[:payload]
    case opts[:method]
    when :get then @mock_rest_client.get opts[:url], headers, post_params
    when :put then @mock_rest_client.put opts[:url], headers, post_params
    when :post then @mock_rest_client.post opts[:url], headers, post_params
    when :delete then @mock_rest_client.delete opts[:url], headers, post_params
    end
  end
end

class Test::Unit::TestCase
  include Checkr::TestData
  include Mocha

  setup do
    @mock = mock
    Checkr.mock_rest_client = @mock
    Checkr.api_key="foo"
  end

  teardown do
    Checkr.mock_rest_client = nil
    Checkr.api_key=nil
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
checkr-official-1.8.0 test/test_helper.rb
checkr-official-1.7.1 test/test_helper.rb
checkr-official-1.7 test/test_helper.rb
checkr-official-1.6 test/test_helper.rb
checkr-official-1.5.4 test/test_helper.rb
checkr-official-1.5.3 test/test_helper.rb
checkr-official-1.5.2 test/test_helper.rb
checkr-official-1.5.1 test/test_helper.rb
checkr-official-1.5.0 test/test_helper.rb
checkr-official-1.4.0 test/test_helper.rb
checkr-official-1.3.1 test/test_helper.rb
checkr-official-1.2.1 test/test_helper.rb
checkr-official-1.2.0 test/test_helper.rb
checkr-official-1.1.2 test/test_helper.rb
checkr-official-1.1.1 test/test_helper.rb
checkr-official-1.1.0 test/test_helper.rb
checkr-official-1.0.2 test/test_helper.rb
checkr-official-1.0.1 test/test_helper.rb
checkr-official-1.0.0 test/test_helper.rb