Sha256: 7af908541f5a16a746d924a8239fd7592b6f1b9f10e2feccc3352c5c8d2d8ede

Contents?: true

Size: 795 Bytes

Versions: 22

Compression:

Stored size: 795 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.to_param,
                   payment_id: payment.to_param
      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 { should render_template(:new) }
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
spree_backend-3.3.0.rc1 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.5 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.2.1 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.2.0 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.4 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.2.0.rc3 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.2.0.rc2 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.2.0.rc1 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.3 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.2 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.0.10 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.1 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.0 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.0.rc4 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.0.9 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.0.rc3 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.0.rc2 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.1.0.rc1 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.0.8 spec/controllers/spree/admin/refunds_controller_spec.rb
spree_backend-3.0.7 spec/controllers/spree/admin/refunds_controller_spec.rb