summaryrefslogtreecommitdiff
path: root/spec/mspec/lib/mspec/matchers/be_empty.rb
blob: 5abd5c9485e6f3e2dba9e6414d459cac77a17f94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class BeEmptyMatcher
  def matches?(actual)
    @actual = actual
    @actual.empty?
  end

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

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

module MSpecMatchers
  private def be_empty
    BeEmptyMatcher.new
  end
end