Sha256: 58c4678335f5158833b34d6a20960f6f7b379bff6b3c6a1333ce68a01fcb3af7

Contents?: true

Size: 734 Bytes

Versions: 4

Compression:

Stored size: 734 Bytes

Contents

module Interactor
  describe Failure do
    describe ".cause_stack" do
      subject { failure.cause_stack }

      let(:exception_1) { Class.new(Exception) }
      let(:exception_2) { Class.new(Exception) }
      let(:interactor) do
        Class.new.send(:include, Interactor) do
          def call
            begin
              raise exception_1
            rescue StandardError
              raise exception_2
            end
          rescue StandardError
            context.fail!
          end
        end
      end

      it "returns an empty stack" do
        interactor.call!
      rescue Failure => e
        expect(e.cause_stack).to contain_exactly(described_class, exception_1, exception_2)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
interactor_with_steroids-1.5.1 spec/interactor/error_spec.rb
interactor_with_steroids-1.5.0 spec/interactor/error_spec.rb
interactor_with_steroids-1.4.0 spec/interactor/error_spec.rb
interactor_with_steroids-1.3.0 spec/interactor/error_spec.rb