Gem.loaded_specs has my gem in irb, but not when running minitest


I write Ruby command line tools and have the option ‘–version’
usually shown via: Gem.loaded_specs[‘my_gem_name’].version

That has worked really well when using RSpec, but I am encountering
problems with minitest (and possibly Coveralls) now. This is for a
completely new gem, so I am not trying to lift RSpec code over to

When I print Gem.loaded_specs.keys in the minitest code, then my gem
is missing. There is a require statement that loads it though
(commenting it out causes an error – so I think it should be listed via

I tried the require in irb and there I can see my gem being listed in
Gem.loaded_specs. It also works during runtime (running the command line
with ‘–version’).

Is there something really obvious that I am missing that breaks the
minitest & Coveralls code?

Thank you,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs