Sha256: 90fe1af05880b92b245283afdbb4a1a9f888eb2ed1929bbc81345b635dffaf5c

Contents?: true

Size: 849 Bytes

Versions: 7

Compression:

Stored size: 849 Bytes

Contents

require 'solidus_paypal_commerce_platform_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

7 entries across 7 versions & 1 rubygems

Version Path
solidus_paypal_commerce_platform-1.0.3 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-1.0.2 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-1.0.1 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-1.0.0 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-1.0.0.beta3 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-1.0.0.beta2 spec/lib/solidus_paypal_commerce_platform/client_spec.rb
solidus_paypal_commerce_platform-1.0.0.beta1 spec/lib/solidus_paypal_commerce_platform/client_spec.rb