Home > Blockchain >  Rspec and SQL: Index 0 is out of range
Rspec and SQL: Index 0 is out of range

Time:05-17

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.

CodePudding user response:

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

  • Related