vendredi 28 septembre 2018

Rails controller integration test can't find model function

I have a controller integration test that creates a new User. As a result of the new User being created, I randomly assign a book to the User. First, I get a list of all available books from Book.get_all_books (a class method), but I am getting the error:

ActiveRecord::RecordNotFound: Couldn't find Book app/models/book.rb:15:in 'get_all_books'

I have prepared the database and it appears it loaded the data from the fixtures. When I launch the console in test mode, I can see the pre-seeded books.

Aucun commentaire:

Enregistrer un commentaire