aliakhtar / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Make spock.lang.Specification a Groovy trait #389

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Describe the enhancement you have in mind.

Would it be possible to implement Specification as a Groovy trait instead of an 
abstract class?  (The abstract class could be part of a separate release to 
maintain support for versions of Groovy prior to 2.3).

Which particular problem would this enhancement solve for you?

I do a lot of work with Apache Camel, which requires all tests to extend the 
CamelTestSupport class.  Since Spock requires extending from Specification, I 
am unable to write my Camel tests using Spock.  And I think there are other 
projects that also expose test functionality via an abstract class that all 
tests must extend.

If Specification was a Groovy trait instead of an abstract class, then I could 
do this to write a spec for testing camel:

class MyCamelSpec extends CamelTestSupport implements Specification {...}

Please provide any additional information below. You can also assign
labels.

Original issue reported on code.google.com by mmindenh...@gmail.com on 20 Feb 2015 at 8:01

GoogleCodeExporter commented 8 years ago
Thanks for the suggestion. This would be very difficult to pull off and is 
unlikely going to happen. Camel should really offer an alternative to the 
CamelTestSupport class, if it doesn't already (as the name of the class 
suggests).

Original comment by pnied...@gmail.com on 20 Feb 2015 at 8:23

GoogleCodeExporter commented 8 years ago
No worries.  I really made the suggestion with very limited understanding of 
traits (just what I gleaned from Cedric Champeau's excellent JavaONE 
presentation), and thought it might be doable.

Original comment by mmindenh...@gmail.com on 20 Feb 2015 at 4:06