Sha256: 5f43efa841cbd7b0151ed6569e94dd4746e35c1b6db52915720a1b5f6d824e29

Contents?: true

Size: 921 Bytes

Versions: 2

Compression:

Stored size: 921 Bytes

Contents

require 'solidus_braintree_helper'

RSpec.describe Spree::Api::OrdersController, type: :request do
  stub_authorization!

  describe 'get show' do
    let(:gateway) { create_gateway }
    let(:order) { create(:order_with_line_items) }
    let(:source) do
      SolidusBraintree::Source.new(
        nonce: 'fake-valid-nonce',
        user: order.user,
        payment_type: SolidusBraintree::Source::PAYPAL,
        payment_method: gateway
      )
    end

    context 'when using braintree as the payment' do
      before do
        allow_any_instance_of(Spree::Payment).to receive(:create_payment_profile).and_return(true)

        order.payments.create!(
          payment_method: gateway,
          source: source,
          amount: 55
        )
      end

      it "can be rendered correctly" do
        get "/api/orders/#{order.number}"

        expect(response).to have_http_status :ok
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_braintree-3.0.1 spec/requests/spree/api/orders_controller_spec.rb
solidus_braintree-3.0.0 spec/requests/spree/api/orders_controller_spec.rb