1 require File.dirname(__FILE__) + '/../spec_helper'
2 require 'mspec/expectations/expectations'
3 require 'mspec/matchers/be_empty'
5 describe BeEmptyMatcher do
6 it "matches when actual is empty" do
7 BeEmptyMatcher.new.matches?("").should == true
10 it "does not match when actual is not empty" do
11 BeEmptyMatcher.new.matches?([10]).should == false
14 it "provides a useful failure message" do
15 matcher = BeEmptyMatcher.new
16 matcher.matches?("not empty string")
17 matcher.failure_message.should == ["Expected \"not empty string\"", "to be empty"]
20 it "provides a useful negative failure message" do
21 matcher = BeEmptyMatcher.new
23 matcher.negative_failure_message.should == ["Expected \"\"", "not to be empty"]