Skip to content

Instantly share code, notes, and snippets.

Created June 24, 2016 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8291072fbd819f2eaf134187701a8ef1 to your computer and use it in GitHub Desktop.
Save anonymous/8291072fbd819f2eaf134187701a8ef1 to your computer and use it in GitHub Desktop.
# Find all the cars of a given color in reverse order by created_at using the `order()` method
# remember time is ever increasing in a positive direction, how do you want to order ASC or DESC?
# assign to a variable reverse_cars
def test_order
reverse_cars = []
cars = 5.times.map {Car.create}
# put your code here
reverse_cars = Car.find(color).order(created_at: :desc)
assert_equal cars.reverse, reverse_cars
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment