Sha256: 3a4720d01fa9f2c6a32bc251ed67d10d72634c083313ddfd385faf257d18e0ad

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

require 'spec_helper'
require 'duedil'

describe Duedil::Director do
  before do
    @api_key  = 'exampleapikey'
    @base_url = 'duedil'
    @version  = 'v'
    @http     = double('http')
    @client = Duedil::Director.new version: @version,
                                   base_url: @base_url,
                                   api_key: 'test',
                                   sandbox: 'true',
                                   http: @http
  end

  describe '#all' do
    it 'build the correct url for searching companies' do
      allow(@http).to receive(:get_response).with(@base_url, "/v/sandbox/uk/directors?filters=%7B%22name%22%3A%22foo%22%7D&api_key=test")
      @client.all(name: 'foo')
    end
  end

  describe '#get' do
    it 'build the correct url for fetching a company' do
      allow(@http).to receive(:get_response).with(@base_url, "/v/sandbox/uk/directors/1?api_key=test")
      @client.get(1)
    end
  end

  describe '#companies' do
    it 'build the correct url for fetching registered_address' do
      allow(@http).to receive(:get_response).with(@base_url, "/v/sandbox/uk/directors/1/companies?limit=100&api_key=test")
      @client.companies(1, limit: 100)
    end
  end

  describe '#directorships' do
    it 'build the correct url for fetching previous_company_names' do
      allow(@http).to receive(:get_response).with(@base_url, "/v/sandbox/uk/directors/1/directorships?limit=100&api_key=test")
      @client.directorships(1, limit: 100)
    end
  end

  describe '#service_addresses' do
    it 'build the correct url for fetching industries' do
      allow(@http).to receive(:get_response).with(@base_url, "/v/sandbox/uk/directors/1/service-addresses?limit=100&api_key=test")
      @client.service_addresses(1, limit: 100)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
duedil-client-0.0.1 spec/duedil/director_spec.rb