Skip to content

Fix NoMethodError: undefined method 'reindex' for class Photo in specs - #4678

Merged
CloCkWeRX merged 2 commits into
devfrom
fix-photo-reindex-error-4629481995101950332
Jun 23, 2026
Merged

CloCkWeRX merged 2 commits into
devfrom
fix-photo-reindex-error-4629481995101950332

Conversation

@CloCkWeRX

Copy link
Copy Markdown
Collaborator

Removed Photo.reindex calls from spec/spec_helper.rb, spec/features/home/home_spec.rb, and spec/features/likeable_spec.rb to fix NoMethodError. Also removed the unnecessary :reindex trait from the photo factory call in spec/features/likeable_spec.rb. Verified that the Photo model is decoupled from Elasticsearch and that these calls were indeed erroneous.


PR created automatically by Jules for task 4629481995101950332 started by @CloCkWeRX

The Photo model is no longer using Searchkick/Elasticsearch, so calling
`Photo.reindex` causes a NoMethodError. This commit removes these calls
from `spec/spec_helper.rb` and feature specs, and removes the unused
`:reindex` trait from the photo factory call in `likeable_spec.rb`.

Co-authored-by: CloCkWeRX <[email protected]>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Remove `Photo.reindex` calls from `spec/spec_helper.rb` and feature specs.
- Modify `LikesController` to conditionally call `reindex` only if the likeable object responds to it, preventing `NoMethodError` for non-indexed models like `Photo`.
- Remove unnecessary `:reindex` trait from photo factory call in `likeable_spec.rb`.

Co-authored-by: CloCkWeRX <[email protected]>
@CloCkWeRX
CloCkWeRX merged commit c0eb49a into dev Jun 23, 2026
16 of 17 checks passed
@CloCkWeRX
CloCkWeRX deleted the fix-photo-reindex-error-4629481995101950332 branch June 23, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant