Guest User

Untitled

a guest
Jan 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 1.77 KB | None | 0 0
  1. # Trying to get this test to pass in active_record_test.rb
  2.   # find the first 4 cars
  3.   # assign to variable `limited_cars`
  4.   def test_limit
  5.     limited_cars = nil
  6.     cars = 5.times.map { Car.create }
  7.  
  8.     #my added code
  9.     limited_cars = Car.limit(4)
  10.  
  11.     assert_equal cars.first(4), limited_cars
  12.   end
  13.  
  14. # Getting this error...
  15.   3) Failure:
  16. test_limit(ActiveRecordTest) [tests/active_record_test.rb:89]:
  17. <[#<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">,
  18.  #<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">,
  19.  #<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">,
  20.  #<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
  21. <[#<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