Created
July 10, 2009 20:10
-
-
Save bpot/144774 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'spec' | |
include Spec::Matchers | |
a = (1..10).to_a | |
b = (5..15).to_a | |
matcher = MatchArray.new(a) | |
matcher.matches?(b) # => false | |
print matcher.failure_message_for_should | |
# Output: | |
# expected collection contained: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
# actual collection contained: [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | |
# the missing elements were: [1, 2, 3, 4] | |
# the extra elements were: [11, 12, 13, 14, 15] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment