Re-enable spec/library for full CI runs.
[rbx.git] / mspec / spec / matchers / eql_spec.rb
blobb62c2c75667ef4654e4c40f10377873763438756
1 require File.dirname(__FILE__) + '/../spec_helper'
2 require 'mspec/expectations/expectations'
3 require 'mspec/matchers/eql'
5 describe EqlMatcher do
6   it "matches when actual is eql? to expected" do
7     EqlMatcher.new(1).matches?(1).should == true
8     EqlMatcher.new(1.5).matches?(1.5).should == true
9     EqlMatcher.new("red").matches?("red").should == true
10     EqlMatcher.new(:blue).matches?(:blue).should == true
11     EqlMatcher.new(Object).matches?(Object).should == true
13     o = Object.new
14     EqlMatcher.new(o).matches?(o).should == true
15   end
17   it "does not match when actual is not eql? to expected" do
18     EqlMatcher.new(1).matches?(1.0).should == false
19     EqlMatcher.new(Hash).matches?(Object).should == false
20   end
22   it "provides a useful failure message" do
23     matcher = EqlMatcher.new("red")
24     matcher.matches?("red")
25     matcher.failure_message.should == ["Expected \"red\"\n", "to have same value and type as \"red\"\n"]
26   end
28   it "provides a useful negative failure message" do
29     matcher = EqlMatcher.new(1)
30     matcher.matches?(1.0)
31     matcher.negative_failure_message.should == ["Expected 1.0\n", "not to have same value or type as 1\n"]
32   end
33 end