Simulating a missing gem in Ruby unit tests

Posted by ktex on Stack Overflow See other posts from Stack Overflow or by ktex
Published on 2010-04-23T08:20:34Z Indexed on 2010/04/23 8:23 UTC
Read the original article Hit count: 226

Filed under:
|
|

Is there any way to simulate the absence of a gem for certain unit tests, short of actually uninstalling and then reinstalling the gem during testing?

I am writing a command line utility, and want to make sure that my tests cover cases where a user may not have all of the gems that I support. For instance, I am using fsevents — a Leopard-specific package for monitoring filesystem events — that will never be present on other systems, as well as a growl gem that's purely optional.

© Stack Overflow or respective owner

Related posts about unit-testing

Related posts about ruby