In ruby, how do I test that one array not only has the elements of another array, but contain them in that particular order?
correct_combination = [1, 2, 3, 4, 5
If you want to ignore the order, (as I did when I came across this post), you could use Array.sort and <=> http://ruby-doc.org/core-1.8.7/classes/Array.html#M000316
a = [1, 2, 3, 4, 5] b = [2, 1, 5, 4, 3] a.sort <=> b.sort
You then need to check the output value equals 0.