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