Solved by adding Model.reindex before my test case.
setup do
Model.reindex
end
Question
I am getting an error while testing an index page which uses sunspot search.
*** NoMethodError Exception: undefined method `[]' for nil:NilClass
The code which i wrote is
@object.hits
This error also occurs with
@object.results
I have tried @object.present? , @object.blank? , @object.nil?
I have used kaminari to paginate my results
= paginate(@object.hits)
Solution
Solved by adding Model.reindex before my test case.
setup do
Model.reindex
end