Sha256: b2eea8e60bb429eecff80ab9d745c859528bebf1d7393cb2887d885bc03086f7

Contents?: true

Size: 928 Bytes

Versions: 6

Compression:

Stored size: 928 Bytes

Contents

require "solidus_stripe_spec_helper"

RSpec.describe SolidusStripe::IntentsController, type: :request do
  describe "GET /after_confirmation" do
    context 'when not provided a payment intent' do
      it 'responds with unprocessable entity' do
        payment_method = create(:solidus_stripe_payment_method)
        order = create(:order_ready_to_complete)
        sign_in order.user

        get "/solidus_stripe/#{payment_method.slug}/after_confirmation"

        expect(response.status).to eq(422)
      end
    end

    context 'when the order is not at "confirm"' do
      it 'redirects to the current order step' do
        payment_method = create(:solidus_stripe_payment_method)
        order = create(:order)
        sign_in order.user

        get "/solidus_stripe/#{payment_method.slug}/after_confirmation?payment_intent=pi_123"

        expect(response).to redirect_to('/checkout/cart')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solidus_stripe-5.0.2 spec/requests/solidus_stripe/intents_controller_spec.rb
solidus_stripe-5.0.1 spec/requests/solidus_stripe/intents_controller_spec.rb
solidus_stripe-5.0.0 spec/requests/solidus_stripe/intents_controller_spec.rb
solidus_stripe-5.0.0.rc.3 spec/requests/solidus_stripe/intents_controller_spec.rb
solidus_stripe-5.0.0.rc.2 spec/requests/solidus_stripe/intents_controller_spec.rb
solidus_stripe-5.0.0.rc.1 spec/requests/solidus_stripe/intents_controller_spec.rb