Skip to content

Instantly share code, notes, and snippets.

@Pomeha
Created October 10, 2018 14:28

Revisions

  1. Pomeha created this gist Oct 10, 2018.
    11 changes: 11 additions & 0 deletions paypal_mocks_for_rspec.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    before do
    paypal_payout_object = double
    payout_batch = double
    allow(payout_batch).to receive_message_chain(:batch_header, :payout_batch_id).and_return(payout_batch_id)
    allow(payout_batch).to receive_message_chain(:batch_header, :batch_status).and_return(payout_batch_status)
    allow(PayPal::SDK::REST::DataTypes::Payout).to receive(:new).and_return(paypal_payout_object)
    allow(paypal_payout_object).to receive(:create).and_return(payout_batch)
    end

    let(:payout_batch_id) { 1_337 }
    let(:payout_batch_status) { 'SUCCESS' }