Gem minitest_lucid Is Up
Tags: ruby, minitest, opensource, testing
Published: 2018-09-15 17:14:54

---
title: Gem minitest_lucid Is Up
published: true
description: Gem to elucidate Minitest failed assertions
tags: ruby, minitest, opensource, testing
---

I have put up gem [minitest_lucid](https://rubygems.org/gems/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

```diff
--- 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."}
```

we get

```ruby
{
  :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.',
    },
  }
}
```

So far, treats <code>Hash</code>, <code>Set</code>, and <code>Struct</code>.  Coming soon:  <code>Array</code> and <code>OpenStruct</code>.

Code and documentation are on [GitHub](https://github.com/BurdetteLamar/minitest_lucid#minitest-lucid).