Sha256: 04926b4b2c39afae1c5ae3920e8d8e7ad68404eb23a1901ff1ee0858fa35fb09
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true require_relative "ignoring_exception/exceptions" module ConvenientService module RSpec module Helpers module Custom class IgnoringException < Support::Command ## # @!attribute [r] exception # @return [StandardError] # attr_reader :exception ## # @!attribute [r] block # @return [Proc] # attr_reader :block ## # @param exception [StandardError] # @param block [Proc] # def initialize(exception, &block) @exception = exception @block = block end ## # @return [ConvenientService::Support::UniqueValue] # @raise [ConvenientService::RSpec::Helpers::Custom::IgnoringException::Exceptions::IgnoredExceptionIsNotRaised] # # @note Rescue `StandardError`, NOT `Exception`. # @see https://thoughtbot.com/blog/rescue-standarderror-not-exception # @see https://ruby-doc.org/core-2.7.0/StandardError.html # @see https://ruby-doc.org/core-2.7.0/Exception.html # def call block.call rescue exception Support::UNDEFINED else raise Exceptions::IgnoredExceptionIsNotRaised.new(exception: exception) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
convenient_service-0.14.0 | lib/convenient_service/rspec/helpers/custom/ignoring_exception.rb |
convenient_service-0.13.0 | lib/convenient_service/rspec/helpers/custom/ignoring_exception.rb |