Sha256: 61adb8371ebd2c06b22d498a137aef75cedac5299bbf16ba6f56926a8b96c3c5

Contents?: true

Size: 791 Bytes

Versions: 16

Compression:

Stored size: 791 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
        spree_post :create,
                   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

16 entries across 16 versions & 1 rubygems

Version Path
solidus_backend-1.2.3 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.1.4 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.0.7 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.0.6 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.2.2 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.2.1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.1.3 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.0.5 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.2.0 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.2.0.rc2 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.0.4 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.1.2 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.2.0.rc1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.2.0.beta1 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.0.3 spec/controllers/spree/admin/refunds_controller_spec.rb
solidus_backend-1.1.1 spec/controllers/spree/admin/refunds_controller_spec.rb