Spec Fix: Minio url_redirects_controller_spec:195
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
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
AI Disclosure
- Cursor used to suggest fix
- Code changes made manually
@ershad can you please review this 🙏🏻
Here as well we shouldn't use conditionals in specs; for this one we can just assume we're using MinIO