On Oct 1, 2011, at 7:03 AM, Felix Schäfer wrote: > Hello, > > 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)? > > Thanks, > > Felix > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Specs do not over-ride each other, so I can't think of an easy to do what you're trying to do. With that said, I have never come across a situation like this because usually the app has one or the other. Shouldn't the user delete their own code that your plugin accomplishes after they install it? Or, maybe your plugin overrides their core functionality, but doesn't provide tests - in which case it's up to the user to adjust their tests to your plugin. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users