gumroad icon indicating copy to clipboard operation
gumroad copied to clipboard

Spec Fix: Minio url_redirects_controller_spec:195

Open VarunArora14 opened this issue 2 months ago • 1 comments

Problem

The spec spec/controllers/api/mobile/url_redirects_controller_spec.rb:195 failed locally as per CI error and local error -

https://github.com/antiwork/gumroad/actions/runs/19107742055/job/54596769004?pr=1773

Screenshot 2025-11-09 at 8 54 27 PM

Other specs have single and_return chain as underlying code hits their presigned_url once the number of times they plan for. In this spec, we call presigned_url four times -

  • subtitle_en_path = file_1.signed_download_url_for_s3_key_and_filename, while building the expected value.
  • subtitle_fr_path = …, for the second expected value.
  • During the controller action, subtitle_files_for_mobile builds the first subtitle hash.
  • The same method builds the second subtitle hash.

There can be ordering issues as well in this spec that should be avoided for english-url and french-url. To keep the spec simple for local, I have added minimal changes to return mocked url as presigned_url.

Fix

Added a presigned_url stub tied to MinIO’s payload only for local purposes. This should not affect the main CI with AWS creds.

After

image

AI Disclosure

  • Cursor used to suggest fix
  • Code changes made manually

VarunArora14 avatar Nov 09 '25 18:11 VarunArora14

@ershad can you please review this 🙏🏻

VarunArora14 avatar Nov 09 '25 18:11 VarunArora14

Here as well we shouldn't use conditionals in specs; for this one we can just assume we're using MinIO

binary-koan avatar Dec 03 '25 15:12 binary-koan