Sha256: 4364406767b26acf0f2e73e0b047d6d78fd5de6a8b439e3ecc42188c3709e40a

Contents?: true

Size: 611 Bytes

Versions: 2

Compression:

Stored size: 611 Bytes

Contents

$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "vultr"
require "minitest/autorun"
require "faraday"
require "json"

class Minitest::Test
  def stub_response(fixture:, status: 200, headers: {"Content-Type" => "application/json"})
    [status, headers, File.read("test/fixtures/#{fixture}.json")]
  end

  def stub_request(path, response:, method: :get, body: {})
    Faraday::Adapter::Test::Stubs.new do |stub|
      arguments = [method, "/v2/#{path}"]
      arguments << body.to_json if [:post, :put, :patch].include?(method)
      stub.send(*arguments) { |env| response }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vultr-2.0.0 test/test_helper.rb
vultr-1.0.0 test/test_helper.rb