DEV Community

Burdette Lamar
Burdette Lamar

Posted on

Gem minitest_lucid Is Up

I have put up gem minitest_lucid, which elucidates data for certain failed Minitest assertions.

The idea is that a failed assertion for, say, a largish hash can be hard to decipher. So the gem organizes the result to make it easier.

Thus, instead of

-------- expected
+++ actual
@@ -1 +1 @@
-{:ina=>"Alita tea loat qani.", :con=>"Et sia adid qua.", :dolupi=>"Parali coal alit qad.", :enaam=>"La ofadi aliq caat.", :qat=>"Magna voaa aaliqu maan.", :vent=>"Do velaa volor na.", :suata=>"Fadi iame adati na.", :ip=>"Utat iram adip voan.", :ex=>"Vat eiua exca inci.", :labor=>"Aut tatat proam iat.", :occaag=>"Co nulab nost paat.", :alitaaa=>"Eaam fugatia exat quis.", :cidaa=>"Enia adiaamea deseaat eliqui.", :eaalabalab=>"Aut te magna aliq.", :ut=>"Param ad dua idatu.", :ullaboa=>"Irat cona doat dunt.", :ipsum=>"Irur na nuaata doaga.", :duat=>"Noaga idat sara ex.", :anis=>"Sint adipi et aut."}
+{:ina=>"Alita tea loat qani.", :con=>"Et sia adid qua.", :euaaag=>"Enta adaad idess utetu.", :enaam=>"la ofadi aliq caat.", :qat=>"Magna voaa aaliqu maan.", :vent=>"do velaa volor na.", :eaarisau=>"Taabore magn naatat in.", :ip=>"Utat iram adip voan.", :ex=>"Vat eiua exca inci.", :labor=>"aut tatat proam iat.", :esedat=>"Dola labor eu null.", :alitaaa=>"Eaam fugatia exat quis.", :cidaa=>"enia adiaamea deseaat eliqui.", :eaalabalab=>"Aut te magna aliq.", :cat=>"Cullum pa quip magat.", :ullaboa=>"Irat cona doat dunt.", :ipsum=>"Irur na nuaata doaga.", :duat=>"Noaga idat sara ex.", :eua=>"Quat comm laal inaa."}
Enter fullscreen mode Exit fullscreen mode

we get

{
  :expected => {
    :class => Hash,
    :size => 19,
  },
  :actual => {
    :class => Hash,
    :size => 19,
  },
  :elucidation => {
    :missing_pairs => {
      :dolupi => 'Parali coal alit qad.',
      :suata => 'Fadi iame adati na.',
      :occaag => 'Co nulab nost paat.',
      :ut => 'Param ad dua idatu.',
      :anis => 'Sint adipi et aut.',
    },
    :unexpected_pairs => {
      :euaaag => 'Enta adaad idess utetu.',
      :eaarisau => 'Taabore magn naatat in.',
      :esedat => 'Dola labor eu null.',
      :cat => 'Cullum pa quip magat.',
      :eua => 'Quat comm laal inaa.',
    },
    :changed_values => {
      :enaam => {
        :expected => 'La ofadi aliq caat.',
        :got      => 'la ofadi aliq caat.',
      },
      :vent => {
        :expected => 'Do velaa volor na.',
        :got      => 'do velaa volor na.',
      },
      :labor => {
        :expected => 'Aut tatat proam iat.',
        :got      => 'aut tatat proam iat.',
      },
      :cidaa => {
        :expected => 'Enia adiaamea deseaat eliqui.',
        :got      => 'enia adiaamea deseaat eliqui.',
      },
    },
    :ok_pairs => {
      :ina => 'Alita tea loat qani.',
      :con => 'Et sia adid qua.',
      :qat => 'Magna voaa aaliqu maan.',
      :ip => 'Utat iram adip voan.',
      :ex => 'Vat eiua exca inci.',
      :alitaaa => 'Eaam fugatia exat quis.',
      :eaalabalab => 'Aut te magna aliq.',
      :ullaboa => 'Irat cona doat dunt.',
      :ipsum => 'Irur na nuaata doaga.',
      :duat => 'Noaga idat sara ex.',
    },
  }
}
Enter fullscreen mode Exit fullscreen mode

So far, treats Hash, Set, and Struct. Coming soon: Array and OpenStruct.

Code and documentation are on GitHub.

Top comments (0)