Sha256: 265fe28da11a28d3e6200f18e6553bc0d00ba4251f60e2d05ecc820cb0cc40f8

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 Bytes

Contents

require 'spec_helper'

describe Direct::API::V5 do
  describe '::client' do
    let(:settings) { { param1: 'value1', param2: 'value2' } }
    let(:client) { double('client') }

    before { allow(described_class::Client).to receive(:new).with(settings).and_return(client) }

    subject { described_class.client(settings) }

    it 'create new client' do
      is_expected.to eq(client)
    end
  end

  describe '::load_settings' do
    let(:yml_path) { 'file_path' }

    it 'call DefaultSettings::load_from_yml' do
      expect(described_class::DefaultSettings).to receive(:load_from_yml).with(yml_path)
      described_class.load_settings(yml_path)
    end
  end

  describe '::configure' do
    # rubocop:disable Style/Proc
    let(:proc) { Proc.new {} }

    it 'call DefaultSettings::configure' do
      expect(described_class::DefaultSettings).to receive(:configure) do |&block|
        expect(proc).to be(block)
      end
      described_class.configure(&proc)
    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_spec.rb
direct-api-v5-0.1.1 spec/direct/api/v5_spec.rb
direct-api-v5-0.1.0 spec/direct/api/v5_spec.rb