resque/resque — pull request #916 by mcfiredrill (2013-03-31 19:05:00+00:00)
Title: In .each, make sure that the proper array is created if there is only

In Resque::Failure.each, make sure that the proper array is created if there is only on failure.

This fixes resque/resque-web#6

If there is only one failure, the Array method turns the hash into an array of arrays, instead of one Array with a single element, the first hash.

The only time we actually *don't* get an array(require us to use `Array()`) is when `Resque.list_range` is called with a count of 1 and use `redis.lindex`, otherwise we use `lrange` which returns an array.

So it seems to be fine to just use `[items].flatten`. If you have a better idea of how to solve this problem let me know! At first I tried changing the `list_range` method to always return an array, but that caused some tests to fail.

This didn't break any tests, and I'd like to write a new test, but I'm a bit unsure about where to start since it would have to integrate so many things (or stub them out). Should I start a redis server in the test, like the legacy tests do?

Anyway I'll add a test today probably, but I wanted to get my work out there early.