'Rspec and SQL: Index 0 is out of range
I am trying to run my code and I get the following error:
Failure/Error: Bookmark.new(id: res[0]['id'], title: res[0]['title'], url: res[0]['url'])
IndexError: Index 0 is out of range
I checked my database table and saw it is all good, there is data there (bookmarks) so not sure why this is occurring.
Solution 1:[1]
Apologies, it was an error on my part. My spec_helper file was referring to a different ENVIRONMENT compared to my code. That's why it couldn't find the data it needed. It's at least a good learning curve for next time
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Farzan |