Testing for optional gems

I added a patch to ActiveAdmin and wanted to write a test for it, but it
is for optional support of a Gem that would interfere with the rest of
the workings of the Gem.

Specifically I added functionality in my patch checks through the
ancestors converting them to strings against a string of a class that
would be included by the other gem and if that module of the optional
gem is an ancestor, it includes a module (that otherwise would not be
included, so its code in theory would never otherwise be executed).

I would like to test this but I don't want to put the gem in Gemfile
because then it would be there and might mess up other tests.

What is a good way to test such functionality without including that Gem
for all tests?

ยทยทยท

--
Posted via http://www.ruby-forum.com/.