[rspec-users] Override tests (of a core rails app from a plugin)

Felix Schäfer f.schaefer at finn.de
Sat Oct 1 09:03:12 EDT 2011


Is there some way to override a spec and more specifically parts of spec, ideally down to a specific example? I've been looking and googling for something like this, but I haven't found a good strategy for it.

The use-case is for a rails app that supports plugins, and those plugins may also tweak the behavior of core objects. For example (and it is a simplistic and bad example, but bear with me): Suppose a User object that has a boolean attribute show_mail_address that controls if the mail address of the user can be shown publicly, and that this defaults to true in the core app, but a security-savvy user of the software doesn't want that and creates a plugin to change the default to false. Running the core tests with the plugin will fail because the default won't be the one the tests expect. Is there any way to selectively override examples/tests/groups and/or extend tests (in the case the plugin adds functionality to the core object)?



More information about the rspec-users mailing list