Skip to content

Instantly share code, notes, and snippets.

@bpot
Created July 10, 2009 20:10
Show Gist options
  • Save bpot/144774 to your computer and use it in GitHub Desktop.
Save bpot/144774 to your computer and use it in GitHub Desktop.
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