toptal / chewy

High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
MIT License
1.88k stars 366 forks source link

Bug in the `mock_elasticsearch_response_sources` method #862

Closed lafeber closed 1 year ago

lafeber commented 1 year ago

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