Sha256: a0a5801cfd903aa54e36a5075eefeb3e363570519d42c0603310fc2afb9b9e26

Contents?: true

Size: 390 Bytes

Versions: 6

Compression:

Stored size: 390 Bytes

Contents

module Mocktail::Matchers
  class That < Base
    def self.matcher_name
      :that
    end

    def initialize(&blk)
      if blk.nil?
        raise "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

6 entries across 6 versions & 1 rubygems

Version Path
mocktail-0.0.6 lib/mocktail/matchers/that.rb
mocktail-0.0.5 lib/mocktail/matchers/that.rb
mocktail-0.0.4 lib/mocktail/matchers/that.rb
mocktail-0.0.3 lib/mocktail/matchers/that.rb
mocktail-0.0.2 lib/mocktail/matchers/that.rb
mocktail-0.0.1 lib/mocktail/matchers/that.rb