Sha256: e42765f25c6957b28d7a3dd12808ffd74f36f69e5a6890f6bfa9518afbba9a64

Contents?: true

Size: 428 Bytes

Versions: 1

Compression:

Stored size: 428 Bytes

Contents

module Mocktail::Matchers
  class That < Base
    extend T::Sig

    def self.matcher_name
      :that
    end

    def initialize(&blk)
      if blk.nil?
        raise ArgumentError.new("The `that` matcher must be passed a block (e.g. `that { |arg| … }`)")
      end
      @blk = blk
    end

    def match?(actual)
      @blk.call(actual)
    rescue
      false
    end

    def inspect
      "that {…}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mocktail-2.0.0 lib/mocktail/matchers/that.rb