Sha256: 172cf8742dd604571e97228c88585a4ddbc32b624ca79e33b79bbc45db10e4fd

Contents?: true

Size: 787 Bytes

Versions: 32

Compression:

Stored size: 787 Bytes

Contents

require 'spec_helper'

describe Spree::Admin::RefundsController do
  stub_authorization!

  describe "POST create" do
    context "a Spree::Core::GatewayError is raised" do
      let(:payment) { create(:payment) }

      subject do
        post :create,
          params: {
          refund: { amount: "50.0", refund_reason_id: "1" },
          order_id: payment.order_id,
          payment_id: payment.id
        }
      end

      before(:each) do
        def controller.create
          raise Spree::Core::GatewayError.new('An error has occurred')
        end
      end

      it "sets an error message with the correct text" do
        subject
        expect(flash[:error]).to eq 'An error has occurred'
      end

      it { is_expected.to render_template(:new) }
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
solidus_backend-2.5.2 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.5.1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.5.0 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.5.0.rc1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.5.0.beta2 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.5.0.beta1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.4.2 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.4.1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.3.1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.2.2 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.1.1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.0.3 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.4.0 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.4.0.rc1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.4.0.beta1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.3.0 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.3.0.rc3 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.3.0.rc2 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.3.0.rc1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-2.3.0.beta1 spec/controllers/spree/admin/refunds_controller_spec.rb