Sha256: e7d8d450232c7e4d291ad695d411194db28eb3f1785a7f8572df883207b37c75

Contents?: true

Size: 808 Bytes

Versions: 3

Compression:

Stored size: 808 Bytes

Contents

require 'spec_helper'

describe Direct::API::V5::Client do
  let(:client) { described_class.new }

  describe '::new' do
    let(:settings) { { param1: 'value1', param2: 'value2' } }
    let(:settings_obj) { double('settings') }

    subject { described_class.new(settings) }

    it 'create Settings object' do
      allow(Direct::API::V5::Settings).to receive(:new).with(settings).and_return(settings_obj)
      expect(subject.settings).to eq(settings_obj)
    end
  end

  describe '#service_name' do
    let(:service_obj) { double('service_obj') }

    it 'return service object' do
      params = { client: client, service_name: :campaigns }
      allow(Direct::API::V5::Service).to receive(:new).with(params).and_return(service_obj)

      expect(client.campaigns).to eq(service_obj)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
direct-api-v5-0.1.2 spec/direct/api/v5/client_spec.rb
direct-api-v5-0.1.1 spec/direct/api/v5/client_spec.rb
direct-api-v5-0.1.0 spec/direct/api/v5/client_spec.rb