Sha256: 433a4136bd74f6e820cee78ea724bcb68e99bd01c5eaa7ef4b183e3a98b1335e

Contents?: true

Size: 816 Bytes

Versions: 5

Compression:

Stored size: 816 Bytes

Contents

require 'spec_helper'

RSpec.describe SolidusPaypalCommercePlatform::Client do
  subject(:client) { described_class.new(client_id: "1234") }

  describe '#execute_with_response' do
    let(:request_class) { SolidusPaypalCommercePlatform::Gateway::OrdersCaptureRequest }
    let(:paypal_request) { double(:request, class: request_class) }
    let(:paypal_response) { double(:response, status_code: status_code, result: nil, headers: {}) }
    let(:status_code) { 201 }

    it 'forwards to the upstream client adding i18n response messages' do
      allow_any_instance_of(PayPal::PayPalHttpClient)
        .to receive(:execute).with(paypal_request).and_return(paypal_response)

      response = subject.execute_with_response(paypal_request)

      expect(response.message).to eq("Payment captured")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_paypal_commerce_platform-0.3.2 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-0.3.1 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-0.3.0 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-0.2.2 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-0.2.1 spec/lib/solidus_paypal_commerce_platform/client_spec.rb