Sha256: faa124da5524da42cb1c1b7b6a9fa4383bd904bc058033ab2d053c682ade2dc9

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

require_relative '../examples'

RSpec.describe 'Budget methods' do
  include_context 'use api'

  let(:budget_id) { add_budget[:budget_ids].first }

  let(:add_budget) do
    api.campaign_management.call(:add_budgets,
      budgets: [
        budget: {
          amount: '10',
          budget_type: 'DailyBudgetStandard',
          name: "test_budget #{random}",
        }
      ]
    )
  end

  describe '#add_budget' do
    it 'returns budget ids for created Budgets' do
      expect(add_budget).to include(
        budget_ids: [a_kind_of(Integer)],
        partial_errors: ''
      )
    end
  end

  describe '#get_budgets_by_ids' do
    before { add_budget }

    it 'returns a list of budgets' do
      expect(api.campaign_management.get_budgets_by_ids(
        budget_ids: [long: budget_id]
      )).to include({
        amount: '10.00',
        association_count: '0',
        budget_type: 'DailyBudgetStandard',
        id: a_kind_of(String),
        name: a_string_starting_with('test_budget'),
      })
    end
  end

  describe '#delete_budgets' do
    before { add_budget }

    it 'returns no errors' do
      expect(api.campaign_management.call(:delete_budgets,
        budget_ids: [ { long: budget_id } ]
      )).to eq(partial_errors: '')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bing_ads_ruby_sdk-1.3.4 spec/examples/2_with_customer/budget_spec.rb
bing_ads_ruby_sdk-1.3.3 spec/examples/2_with_customer/budget_spec.rb
bing_ads_ruby_sdk-1.3.2 spec/examples/2_with_customer/budget_spec.rb
bing_ads_ruby_sdk-1.3.1 spec/examples/2_with_customer/budget_spec.rb
bing_ads_ruby_sdk-1.3.0 spec/examples/2_with_customer/budget_spec.rb
bing_ads_ruby_sdk-1.2.0 spec/examples/2_with_customer/budget_spec.rb
bing_ads_ruby_sdk-1.1.1 spec/examples/2_with_customer/budget_spec.rb