Skip to content

Instantly share code, notes, and snippets.

@Sixeight
Created November 12, 2009 11:05
Show Gist options
  • Select an option

  • Save Sixeight/232815 to your computer and use it in GitHub Desktop.

Select an option

Save Sixeight/232815 to your computer and use it in GitHub Desktop.
Spec::Matchers.create :be_same_list do |other|
match do |me|
me.sort == other.sort
end
end
[1, 2, 3, 4].should be_same_list([2, 1 ,4, 3])
[1, 2, 3, 4].should_not be_same_list([2, 4, 3])
# or
def be_same_list(other)
simple_match('same list') do |me|
me.sort == other.sort
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment