diff --git a/app/views/spree/api/source_views/_paypal_braintree.json.jbuilder b/app/views/spree/api/payments/source_views/_paypal_braintree.json.jbuilder similarity index 100% rename from app/views/spree/api/source_views/_paypal_braintree.json.jbuilder rename to app/views/spree/api/payments/source_views/_paypal_braintree.json.jbuilder diff --git a/spec/requests/spree/api/orders_controller_spec.rb b/spec/requests/spree/api/orders_controller_spec.rb new file mode 100644 index 00000000..ebb882e5 --- /dev/null +++ b/spec/requests/spree/api/orders_controller_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +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 + SolidusPaypalBraintree::Source.new( + nonce: 'fake-valid-nonce', + user: order.user, + payment_type: SolidusPaypalBraintree::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.status).to eq 200 + end + end + end +end