Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Trying to get this test to pass in active_record_test.rb
- # find the first 4 cars
- # assign to variable `limited_cars`
- def test_limit
- limited_cars = nil
- cars = 5.times.map { Car.create }
- #my added code
- limited_cars = Car.limit(4)
- assert_equal cars.first(4), limited_cars
- end
- # Getting this error...
- 3) Failure:
- test_limit(ActiveRecordTest) [tests/active_record_test.rb:89]:
- <[#<Car id: 13, color: nil, condition: nil, top_speed: nil, dealership_id: nil, created_at: "2012-10-14 12:35:39", updated_at: "2012-10-14 12:35:39">,
- #<Car id: 14, color: nil, condition: nil, top_speed: nil, dealership_id: nil, created_at: "2012-10-14 12:35:39", updated_at: "2012-10-14 12:35:39">,
- #<Car id: 15, color: nil, condition: nil, top_speed: nil, dealership_id: nil, created_at: "2012-10-14 12:35:39", updated_at: "2012-10-14 12:35:39">,
- #<Car id: 16, color: nil, condition: nil, top_speed: nil, dealership_id: nil, created_at: "2012-10-14 12:35:39", updated_at: "2012-10-14 12:35:39">]> expected but was
- <[#<Car id: 1, color: "liger yellow", condition: nil, top_speed: 5, dealership_id: 1, created_at: "2012-10-14 12:35:39", updated_at: "2012-10-14 12:35:39">, #<Car id: 2, color: "liger yellow", condition: nil, top_speed: 5, dealership_id: 2, created_at: "2012-10-14 12:35:39", updated_at: "2012-10-14 12:35:39">, #<Car id: 3, color: "liger yellow", condition: nil, top_speed: 5, dealership_id: 3, created_at: "2012-10-14 12:35:39", updated_at: "2012-10-14 12:35:39">, #<Car id: 4, color: "liger yellow", condition: nil, top_speed: 2, dealership_id: 4, created_at: "2012-10-14 12:35:39", updated_at: "2012-10-14 12:35:39">, #<Car id: 5, color: "red", condition: nil, top_speed: nil, dealership_id: 8, created_at: "2012-10-14 12:35:39", updated_at: "2012-10-14 12:35:39">]>.
Add Comment
Please, Sign In to add comment