Grant
Grant

Reputation: 447

No ".includes?" ruby method when running RSpec Test

I've recently got into RSpec and i'm writing some tests for my code, one of things my code has is a section where it starts by going if category.name.includes?(matcher) and then it does something, running this code in production is fine however whenever i'm testing that piece of code with RSpec I get the following error:

undefined method 'includes?' for "category21":String

To clear some things up, my factories do clearly define the categories name, i'm mainly wondering if I need to include some form of library to get it to play nicely?

Thanks, Grant

Upvotes: 0

Views: 42

Answers (1)

Maxim
Maxim

Reputation: 9961

You should use include?, not includes?.

Upvotes: 2

Related Questions