toptal/chewy

Bug in the `mock_elasticsearch_response_sources` method

lafeber opened this issue · 0 comments

Expected behavior

I expect the ids in this method to be active record id's.

What actually happens.

The _ids from the mock_elasticsearch_response_sources method start at 1 and are automatically incremented from an each with index loop. Hence the ActiveRecord lookup fails, resulting in the error ActionView::Template::Error: 'nil' is not an ActiveModel-compatible object. It must implement :to_partial_path (because of a [nil] hash value).

Steps to reproduce the problem

In the hits hash in the helpers_spec.rb, change _id: from 1 (which is conveniently the first id in the loop) to 2. Spec fails. Passes again here

Version Information

  • Chewy version: 7.2.6 (latest)
  • Elasticsearch version: any
  • Ruby version: any
  • Rails version: any