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
You can use each_cons method:
arr = [1, 2, 3, 4, 5] [1, 5, 8, 2, 3, 4, 5].each_cons(arr.size).include? arr
In this case it will work for any elements.