Sha256: d499db30a9c966e99b3ef511a16cd47239bef73017a3574e4c239aad9c2f4587

Contents?: true

Size: 1.24 KB

Versions: 16

Compression:

Stored size: 1.24 KB

Contents

RSpec.describe 'Integration test' do
  it 'returns an affiliate with correct data types', :vcr do
    result = SoapyCake::Admin.new.affiliates(affiliate_id: 16027)
    expect(result.count).to eq(1)
    expect(result.first).to include(
      affiliate_id: 16027,
      # strings
      affiliate_name: 'Affiliate Test 1',
      # booleans
      hide_offers: false,
      # hashes and id-params
      billing_cycle: { billing_cycle_id: 1, billing_cycle_name: 'Weekly' },
      # dates
      date_created: DateTime.new(2014, 4, 28, 10, 52, 15.537),
      # floats
      minimum_payment_threshold: '0.0000'
    )

    # arrays
    expect(result.first[:contacts][:contact_info].map { |contact| contact[:contact_id] }).to \
      eq([8819, 8820])
  end

  it 'returns a clicks report with a defined time range', :vcr do
    result = SoapyCake::Admin.new.clicks(
      start_date: Date.new(2014, 6, 30),
      end_date: Date.new(2014, 7, 1),
      row_limit: 1
    )

    expect(result.count).to eq(1)
    expect(result.first).to include(
      click_id: 1275452,
      visitor_id: 1208222
    )
  end

  it 'raises if there is an error', :vcr do
    expect do
      SoapyCake::Admin.new.affiliates(affiliate_id: 'bloops')
    end.to raise_error(SoapyCake::RequestFailed)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
soapy_cake-1.6.3 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.6.2 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.6.1 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.6.0 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.5.2 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.5.1 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.5.0 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.4.0 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.3.6 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.3.5 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.3.4 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.3.3 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.3.2 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.3.1 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.3.0 spec/lib/soapy_cake/integration_spec.rb
soapy_cake-1.2.0 spec/lib/soapy_cake/integration_spec.rb