Sha256: 6c3e20c91ecaafc844015ee3bf46a2d8788a1e5dc7261cb603e218a757936c57

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

require_relative '../lib/config.rb'
require_relative '../lib/voucherify_data.rb'
require 'VoucherifySdk'

RSpec.describe 'Campaigns API', :order => :defined do
  before(:each) do
    @vouchers_api_instance = Config.vouchers_api_instance()
    @voucherify_data = VoucherifyData.instance()
  end

  it 'get voucher previously created', :order => :first do
    voucher = @vouchers_api_instance.get_voucher(@voucherify_data.get_voucher().code)

    expect(voucher).not_to be_nil
  end

  it 'disable voucher previously created', :order => :second do
    voucher = @vouchers_api_instance.disable_voucher(@voucherify_data.get_voucher().code)

    expect(voucher).not_to be_nil
  end

  it 'enable voucher previously created', :order => :thrird do
    voucher = @vouchers_api_instance.enable_voucher(@voucherify_data.get_voucher().code)

    expect(voucher).not_to be_nil
  end

  it 'update loyalty card balance', :order => :fourth do
    vouchers_balance_update_request_body = VoucherifySdk::VouchersBalanceUpdateRequestBody.new({
        source_id: generate_random_string(),
        amount: 10000,
        reason: "Regular customer"
      })
    
    response = @vouchers_api_instance.update_voucher_balance(@voucherify_data.get_loyalty_card().code, vouchers_balance_update_request_body)

    expect(response).not_to be_nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voucherify-5.0.0 __tests__/spec/7_vouchers_spec.rb