Sha256: 5e3e8b7e98273465911d37d4c44f7591bf200cf18fe0a4a40b7b2a8e226a1b1d

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

RSpec.describe SoapyBing::Accounts do
  describe '#customer_management' do
    subject(:accounts) { described_class.new }

    let(:accounts_list_response) do
      {
        accounts_info: {
          account_info: [
            { id: '123' },
            { id: '456' }
          ]
        }
      }
    end

    before do
      allow(accounts.service).to receive(:get_accounts_info).and_return(accounts_list_response)
    end

    it 'returns accounts list' do
      result = accounts.list

      expect(result.size).to eq(2)
      expect(result.first.account_id).to eq('123')
      expect(result.last.account_id).to eq('456')
    end

    context 'without BING_ADS_ACCOUNT_ID' do
      around do |example|
        original_bing_ads_account_id = ENV['BING_ADS_ACCOUNT_ID']
        ENV.delete('BING_ADS_ACCOUNT_ID')
        example.run
        ENV['BING_ADS_ACCOUNT_ID'] = original_bing_ads_account_id
      end

      it 'returns accounts list' do
        result = accounts.list

        expect(result.size).to eq(2)
        expect(result.first.account_id).to eq('123')
        expect(result.last.account_id).to eq('456')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
soapy_bing-1.0.1 spec/soapy_bing/accounts_spec.rb
soapy_bing-1.0.0 spec/soapy_bing/accounts_spec.rb
soapy_bing-0.4.0 spec/soapy_bing/accounts_spec.rb