The parameter passed to Module.included is always a Module so the check for deciding if the library should inject the ModuleMethods was not doing any checks at all.
Since a Class is always also a Module, the check should check to see if the parameter is not a Class instead. This makes sure that ModuleMethods is only included into modules and never to classes.
I also added a test to verify these expectations explicitly.
The parameter passed to
Module.included
is always aModule
so the check for deciding if the library should inject theModuleMethods
was not doing any checks at all.Since a
Class
is always also aModule
, the check should check to see if the parameter is not aClass
instead. This makes sure thatModuleMethods
is only included into modules and never to classes.I also added a test to verify these expectations explicitly.