CodeSampleX

Exemplo

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

Amostra 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 rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu. Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas. MIT-0

Evidência de execução

O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.

Base da evidência
Contrato assinado aprovado
Recibos de verificação
2
Chaves de assinatura que o compilaram
2
Ambiente declarado ruby linux x64 ruby ruby rubygems

Ambientes das execuções de verificação

Ambiente Contrato Etapas Execução
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
Pacotes
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
Ambiente
ruby
Criado
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

Arquivos

  • 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

Baixar o artefato de código-fonte (tar.gz)

Seeder de origem

csx-seed