Sha256: a97cbe1715155dc0e8cf718532e2b41d248f6159f681ecae9651e794175dd5cb

Contents?: true

Size: 409 Bytes

Versions: 9

Compression:

Stored size: 409 Bytes

Contents

module Mocktail::Matchers
  class That < Base
    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

9 entries across 9 versions & 1 rubygems

Version Path
mocktail-1.2.3 lib/mocktail/matchers/that.rb
mocktail-1.2.2 lib/mocktail/matchers/that.rb
mocktail-1.2.1 lib/mocktail/matchers/that.rb
mocktail-1.2.0 lib/mocktail/matchers/that.rb
mocktail-1.1.3 lib/mocktail/matchers/that.rb
mocktail-1.1.2 lib/mocktail/matchers/that.rb
mocktail-1.1.1 lib/mocktail/matchers/that.rb
mocktail-1.1.0 lib/mocktail/matchers/that.rb
mocktail-1.0.0 lib/mocktail/matchers/that.rb