[rspec-users] have_same_elements_of proposal

Rodrigo Rosenfeld Rosas lbocseg at yahoo.com.br
Wed Oct 28 19:44:24 EDT 2009


How about having this matcher along the default available matchers?

require 'set'
Spec::Matchers.define :have_same_elements_of do |expected|
   match do |actual|
     expected.to_set == actual.to_set
   end
end

Example:

[1,2].should have_same_elements_of([2,1])

Best Regards,

Rodrigo.

__________________________________________________
Faça ligações para outros computadores com o novo Yahoo! Messenger 
http://br.beta.messenger.yahoo.com/ 


More information about the rspec-users mailing list