Files
redux-scraper/backlog/tasks/task-87 - Fix-Domain-PostsController-visual_results-spec-mock-data.md
2025-08-14 18:58:14 +00:00

1.5 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies
id title status assignee created_date updated_date labels dependencies
task-87 Fix Domain::PostsController visual_results spec mock data Done
@assistant
2025-08-14 2025-08-14

Description

The visual_results controller spec is failing because it mocks generate_fingerprints with incorrect return data. The method expects an array of GenerateFingerprintsResult objects but the test provides an empty ActiveRecord relation, causing the controller to render the error template instead of the success template.

Acceptance Criteria

  • Test passes with correct template rendering
  • Mock data matches expected GenerateFingerprintsResult structure
  • No regression in other controller tests

Implementation Notes

Fixed the Domain::PostsController visual_results spec by correcting the mock data structure. The test was mocking generate_fingerprints to return Domain::PostFile::BitFingerprint.none (an empty ActiveRecord relation), but the method actually returns an array of GenerateFingerprintsResult objects. This caused the controller to take the error path and render :visual_search instead of :visual_results. Updated the test to: 1) Mock generate_fingerprints with proper GenerateFingerprintsResult objects containing thumb_path, fingerprint, and detail_fingerprint fields, 2) Added missing mock for create_image_thumbnail_data_uri helper method, 3) Updated variable names to match the new mock structure. All 12 controller tests now pass.