Sha256: 1f6db6ccacdcc7253b4d7274294998068abde0946047b486744a4998ea9802a7

Contents?: true

Size: 847 Bytes

Versions: 62

Compression:

Stored size: 847 Bytes

Contents

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

62 entries across 62 versions & 1 rubygems

Version Path
soapy_cake-1.21.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.20.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.19.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.18.1 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.18.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.16.2 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.16.1 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.16.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.15.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.14.4 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.14.3 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.14.2 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.14.1 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.14.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.13.1 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.13.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.11.6 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.12.0 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.11.5 spec/lib/soapy_cake/affiliate_spec.rb
soapy_cake-1.11.4 spec/lib/soapy_cake/affiliate_spec.rb