Sha256: 63b665b3b8487581e98ebfe1e05723515ecd00cb6d82d2f41935fd9dd62c5a71

Contents?: true

Size: 743 Bytes

Versions: 9

Compression:

Stored size: 743 Bytes

Contents

require 'spec_helper'
require 'mspec/expectations/expectations'
require 'mspec/matchers'

describe BeEmptyMatcher do
  it "matches when actual is empty" do
    BeEmptyMatcher.new.matches?("").should == true
  end

  it "does not match when actual is not empty" do
    BeEmptyMatcher.new.matches?([10]).should == false
  end

  it "provides a useful failure message" do
    matcher = BeEmptyMatcher.new
    matcher.matches?("not empty string")
    matcher.failure_message.should == ["Expected \"not empty string\"", "to be empty"]
  end

  it "provides a useful negative failure message" do
    matcher = BeEmptyMatcher.new
    matcher.matches?("")
    matcher.negative_failure_message.should == ["Expected \"\"", "not to be empty"]
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mspec-1.9.1 spec/matchers/be_empty_spec.rb
mspec-1.9.0 spec/matchers/be_empty_spec.rb
mspec-1.8.0 spec/matchers/be_empty_spec.rb
mspec-1.7.0 spec/matchers/be_empty_spec.rb
mspec-1.6.0 spec/matchers/be_empty_spec.rb
mspec-1.5.21 spec/matchers/be_empty_spec.rb
mspec-1.5.20 spec/matchers/be_empty_spec.rb
mspec-1.5.19 spec/matchers/be_empty_spec.rb
mspec-1.5.18 spec/matchers/be_empty_spec.rb