aboutsummaryrefslogtreecommitdiffstats
path: root/spec/mspec/lib/mspec/matchers/be_nil.rb
blob: 049b1e3a53d279224742f8e859ed49f036c3aa80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class BeNilMatcher
  def matches?(actual)
    @actual = actual
    @actual.nil?
  end

  def failure_message
    ["Expected #{@actual.inspect}", "to be nil"]
  end

  def negative_failure_message
    ["Expected #{@actual.inspect}", "not to be nil"]
  end
end

module MSpecMatchers
  private def be_nil
    BeNilMatcher.new
  end
end