removeSetupTeardown(new FooSpec())
removeSetupTeardown(new BarSpec())
private def removeSetupTeardown(spec: Specification) = spec.fragments.middleDrop(1).middleDropRight(1)
}
But this gives me compiler error:
missing arguments for method fragments in trait FragmentsBuilder;
[error] follow this method with `_' if you want to treat it as a partially applied function
[error] spec.fragments.middleDrop(1).middleDropRight(1)
Possibly because FooSpec and BarSpec are mutable.Specificaitons ?
So, I tried a different way:
FooSpec and BarSpec do not extend BaseSpec anymore, but have skipAllUnless(dbConnection) argument.
class FooBarSpec extends BaseSpec {
sequential
new FooSpec()
new BarSpec()
}
Result: Compiles successfully. FooSpec and BarSpec are skipped. Then it enters FooBarSpec.
But FooSpec inside FooBarSpec complains that there's no db connection.
BaseSpec wraps fragments with initialization and teardown... Not sure why this is happening.
Also tried,
class FooBarSpec extends Specification {
sequential
Step(DB.initialize)
new FooSpec()
new BarSpec()
Step(DB.teardown)
}
But above does not compile because missing `is` method definition.