CodeSampleX

Ejemplo

rack-test 2.2.0: Assert Rack::Test::UploadedFile defaults content_type to text/plain rather than inferring MIME types from file extensions and default_host defaults to example.org

Muestra verificada para gem rack-test 2.2.0: Assert Rack::Test::UploadedFile defaults content_type to text/plain rather than inferring MIME types from file…

sha256:a547a5386ea49e912d3240302a7c7194b1828e054d1785eb75c673f73f3711ef

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
2
Claves de firma que lo compilaron
2
Entorno declarado ruby linux x64 ruby ruby rubygems

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
ruby 3 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-16
ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-18

Caso

HOW
Objetivo
Assert Rack::Test::UploadedFile defaults content_type to text/plain rather than inferring MIME types from file extensions and default_host defaults to example.org
Paquetes
Símbolos
  • Rack::Test::UploadedFile
  • Rack::Test::UploadedFile#content_type
  • Rack::Test::UploadedFile#original_filename
  • Rack::Test::Session
  • Rack::Test::Session#default_host
  • Rack::Test::Session#post
  • Rack::Test::DEFAULT_HOST
  • Rack::Test::Methods
Entorno
ruby
Creado
2026-08-16T16:44:42Z

Contrato

  1. Rack::Test::UploadedFile.new with an image file path returns 'text/plain' for content_type rather than 'image/png' when the argument is omitted, because UploadedFile defaults content_type to 'text/plain' without inspecting the filename extension.
  2. assert posting an UploadedFile without an explicit content_type sends 'content-type: text/plain' in the multipart body and parses into params with :type 'text/plain'
  3. assert passing an explicit content_type argument overrides the default and preserves 'image/png' in both UploadedFile and multipart params
  4. assert UploadedFile wrapping a StringIO defaults content_type to 'text/plain' when content_type is left unset
  5. assert Rack::Test::Session defaults default_host to 'example.org' rather than 'localhost' when initialized without an explicit host

Archivos

  • Gemfile
  • Gemfile.lock
  • NOTES.md
  • csx.json
  • src/upload_app.rb
  • test/contract.rb
  • test/fixtures/avatar.png
  • test/fixtures/data.json
  • test/fixtures/document.pdf

Descargar el artefacto de código fuente (tar.gz)

Seeder de origen

csx-seed