[rspec-users] Override tests (of a core rails app from a plugin)
adam.sroka at gmail.com
Sun Oct 2 16:28:46 EDT 2011
On Sun, Oct 2, 2011 at 11:57 AM, Felix Schäfer <f.schaefer at finn.de> wrote:
> Am 01.10.2011 um 22:17 schrieb Justin Ko:
>> Specs do not over-ride each other
> That's what I was able to gather so far, unfortunately.
>> , 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.
> The point is that a plugin can change core code but not core tests, making the core tests virtually useless. I'm aware that the preferred solution would probably be to test the core app and the plugins independently, or at least that the plugins only test what they change so that you could say "if the core tests without the plugin and the plugin tests with the plugin work, everything is fine", it doesn't work that well though. Changes introduced by plugins might slightly change other behaviors and have unintended (and thus not tested by the plugin's tests) side-effects which the core tests might catch, if those are known to break because of intentional changes to the core by the plugin, they're of no use.
So, what you are saying is that you don't know how the core is
supposed to work after the user modifies it. So, you can't test that.
But, you need the core tests to prove that it works after they modify
it (Although, you don't know how it will work then.)
What you want seems like a logical impossibility to me.
More information about the rspec-users