Sha256: ed28ad02f4993a7a009703f4fc65bf1371ebfea79aa290dd6d1cbff5cf5963df

Contents?: true

Size: 432 Bytes

Versions: 2

Compression:

Stored size: 432 Bytes

Contents

module Spectus
  module Matcher

    # Provides the implementation for `raise_exception`.
    class RaiseException
      def initialize expected
        @expected = expected

        freeze
      end

      # @return [Boolean] Comparison between actual and expected values.
      def matches?
        begin
          yield
        rescue @expected
          true
        else
          false
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spectus-1.0.1 lib/spectus/matcher/raise_exception.rb
spectus-1.0.0 lib/spectus/matcher/raise_exception.rb