Sha256: ad5016555d29a02db33e5aa18950185e174cac24ba851fec932e77776ff86d1e

Contents?: true

Size: 1001 Bytes

Versions: 4

Compression:

Stored size: 1001 Bytes

Contents

require 'rainforest'
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 Rainforest
  class << self
    attr_accessor :mock_rest_client
  end

  module Requester
    def self.request(method, url, params, headers)
      case method
      when :get then Rainforest::mock_rest_client.get(url, headers, params)
      when :put then Rainforest::mock_rest_client.put(url, headers, params)
      when :post then Rainforest::mock_rest_client.post(url, headers, params)
      when :delete then Rainforest::mock_rest_client.delete(url, headers, params)
      else
        raise "Invalid method"
      end
    end
  end
end

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

  setup do
    @mock = mock
    Rainforest.mock_rest_client = @mock
  end

  teardown do
    Rainforest.mock_rest_client = nil
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rainforest-2.1.0 test/test_helper.rb
rainforest-2.0.2 test/test_helper.rb
rainforest-2.0.1 test/test_helper.rb
rainforest-2.0.0 test/test_helper.rb