Reputation: 163
I am running the following rspec test
expect(City.first.city_openings('2014-05-01', '2014-05-05')).to include(@listing2,@listing3)
I am getting this result
This is confusing to me because it seems that my result does in fact include the right values. But rspec says that my result "does not respond to include?" Any ideas on how to fix this? I don't see much about it anywhere.
Upvotes: 2
Views: 3084
Reputation: 153
Your method city_openings return true and not a array. TrueClass is not iterable with include? method.
See the documentation here
https://relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/include-matcher
https://relishapp.com/rspec/rspec-expectations/v/3-7/docs/built-in-matchers/match-matcher
Upvotes: 6