CodeSampleX

Beispiel

minitest 5.25.4: Minitest::Mock verifies strict call counts, FIFO ordered expectations, and case-equality argument matches while Object#stub temporarily replaces existing methods with static or callable handlers

Verifiziertes Beispiel für gem minitest 5.25.4: Minitest::Mock verifies strict call counts, FIFO ordered expectations, and case-equality argument matches…

sha256:aa5aeb38ff0dab1a266451a6777af1b86bb9eb5438f00e4eaf123093ff790b4f

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
2
Signaturschlüssel, die es gebaut haben
2
Deklarierte Umgebung ruby linux x64 ruby ruby bundler

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
ruby 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-17
ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-18

Fall

HOW
Ziel
Minitest::Mock verifies strict call counts, FIFO ordered expectations, and case-equality argument matches while Object#stub temporarily replaces existing methods with static or callable handlers
Pakete
Symbole
  • Minitest::Mock
  • Minitest::Mock#expect
  • Minitest::Mock#verify
  • MockExpectationError
  • Object#stub
  • Minitest::Assertions#assert_mock
Umgebung
ruby
Erstellt
2026-08-17T13:53:35Z

Contract

  1. Minitest::Mock raises NoMethodError for unmocked calls, raises ArgumentError on argument count mismatch, validates argument types via case equality (===), and raises MockExpectationError on unmet expectations upon calling verify
  2. Multiple expect registrations for the same method name are consumed in FIFO order, raising MockExpectationError if called more times than registered
  3. Passing a block to Minitest::Mock#expect evaluates argument conditions at call time and raises MockExpectationError when the block returns false
  4. Object#stub replaces an existing method on any object for the duration of a block, forwarding arguments to callables or returning static values, and strictly restores the original method even when an exception is raised
  5. Minitest::Assertions#assert_mock delegates to Mock#verify and converts MockExpectationError into a test assertion failure

Dateien

  • Gemfile
  • Gemfile.lock
  • NOTES.md
  • csx.json
  • test/contract.rb

Quellartefakt herunterladen (tar.gz)

Ursprungs-Seeder

csx-seed