Skip to content

Remove the test-only ruby-filemagic dependency - #52

Merged
tagliala merged 1 commit into
masterfrom
fix/remove-test-filemagic
Sep 22, 2026
Merged

tagliala merged 1 commit into
masterfrom
fix/remove-test-filemagic

Conversation

@tagliala

Copy link
Copy Markdown
Member

Summary

Fixes #50.

Ruby-head fails to install ruby-filemagic because Ruby 4.1 removed the legacy Data_Wrap_Struct and Data_Get_Struct C APIs it uses. This dependency only supports two test assertions; production uploads already use Marcel.

  • Remove ruby-filemagic and its test-helper require.
  • Assert downloaded bytes against File.binread of the fixture and the conversion response against the exact recorded OCR text, including its newline.
  • Remove the unnecessary libmagic installation steps from both CI workflows.

Production MIME detection, cassettes, and recorded server error expectations are unchanged. Filename-based upload detection and request-body coverage remain separate follow-ups.

Verification

bundle exec rspec (29 examples, 0 failures) and bundle exec rubocop pass locally on:

  • Ruby 3.2.11
  • Ruby 4.0.7
  • Ruby 4.1.0dev, revision 8d4efc1495, built from source using mise

Ruby 4.0.7 was tested with a fresh dependency resolution including Marcel 2.1.0; the same resolution also passes on Ruby-head. Ruby-head additionally passes with CI=true, reporting 100% line coverage (146/146).

The Ruby-head check uses a newer revision than the original failing CI job, and local checks ran on macOS arm64. The Linux CI matrix will provide the remaining validation.

Ruby 4.1 removed the legacy C APIs used by ruby-filemagic, causing
Ruby-head CI to fail before the specs run.

Assert exact downloaded bytes and recorded OCR text instead of using
a MIME detector. Remove the unused libmagic setup from both workflows
without changing production MIME detection.
@tagliala
tagliala merged commit c8becab into master Sep 22, 2026
8 checks passed
@tagliala
tagliala deleted the fix/remove-test-filemagic branch September 22, 2026 18: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.

Remove the test-only ruby-filemagic dependency

1 participant