Sha256: fc96068dec4b0fd523728a43c67f5d0c90608d6a984fc4253f4d5a0c95c96977

Contents?: true

Size: 877 Bytes

Versions: 5

Compression:

Stored size: 877 Bytes

Contents

# frozen_string_literal: true
RSpec.describe SoapyCake::Affiliate do
  let(:affiliate_id) { 42 }
  let(:opts) { { a: 1 } }
  let(:cake_opts) { opts.merge(affiliate_id: affiliate_id) }

  subject { described_class.new(affiliate_id: affiliate_id) }

  shared_examples_for 'a cake affiliate method' do
    it 'runs the request' do
      request = double('request')
      expect(SoapyCake::Request).to receive(:new)
        .with(:affiliate, service, method, cake_opts).and_return(request)
      expect(subject).to receive(:run).with(request)

      subject.public_send(method, opts)
    end
  end

  describe '#bills' do
    let(:service) { :reports }
    let(:method) { :bills }
    it_behaves_like 'a cake affiliate method'
  end

  describe '#offer_feed' do
    let(:service) { :offers }
    let(:method) { :offer_feed }
    it_behaves_like 'a cake affiliate method'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
soapy_cake-1.24.1 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.23.1 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.23.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.22.1 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.22.0 spec/lib/soapy_cake/affiliate_spec.rb