Re-enable spec/library for full CI runs.
[rbx.git] / mspec / spec / matchers / be_ancestor_of_spec.rb
blobae45ce878e65f809e8989eec286bad6edacc6b67
1 require File.dirname(__FILE__) + '/../spec_helper'
2 require 'mspec/expectations/expectations'
3 require 'mspec/matchers/be_ancestor_of'
5 class Parent; end
6 class Child < Parent; end
8 describe BeAncestorOfMatcher do
9   it "matches when actual is an ancestor of expected" do
10     BeAncestorOfMatcher.new(Child).matches?(Parent).should == true
11   end
13   it "does not match when actual is not an ancestor of expected" do
14     BeAncestorOfMatcher.new(Parent).matches?(Child).should == false
15   end
17   it "provides a useful failure message" do
18     matcher = BeAncestorOfMatcher.new(Parent)
19     matcher.matches?(Child)
20     matcher.failure_message.should == ["Expected Child", "to be an ancestor of Parent"]
21   end
23   it "provides a useful negative failure message" do
24     matcher = BeAncestorOfMatcher.new(Child)
25     matcher.matches?(Parent)
26     matcher.negative_failure_message.should == ["Expected Parent", "not to be an ancestor of Child"]
27   end
28 end