Sha256: 449bef06a7a8c3e9bd5c2009f90415716f0f5235a79a1426ef0dc80fe9a134ec

Contents?: true

Size: 389 Bytes

Versions: 4

Compression:

Stored size: 389 Bytes

Contents

module Matchi
  # **Nil** matcher.
  class BeNil < BasicObject
    # @example Is it nil?
    #   be_nil = Matchi::BeNil.new
    #   be_nil.matches? { nil } # => true
    #
    # @yieldreturn [#object_id] the actual value to compare to the expected one.
    #
    # @return [Boolean] Comparison between actual and expected values.
    def matches?
      nil.equal?(yield)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
matchi-0.0.9 lib/matchi/be_nil.rb
matchi-0.0.8 lib/matchi/be_nil.rb
matchi-0.0.7 lib/matchi/be_nil.rb
matchi-0.0.6 lib/matchi/be_nil.rb