Skip to content

Commit

Permalink
Improve Javadoc of IncludeExcludeExtensionSpec, Remove static block (#26
Browse files Browse the repository at this point in the history
)

Setting system property "spock.configuration" during class
initialisation is too late for Spock to pick up the config, so the
static block is pointless and misleads users to believe they can
actually configure the system this way.

Instead the Javadoc was amended by information how to set the system
property via '-D' JVM command-line argument when running a test from an
IDE (or from the command line, for that matter).
  • Loading branch information
kriegaex authored and leonard84 committed Sep 24, 2018
1 parent fb70660 commit 043ef13
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/test/groovy/IncludeExcludeExtensionSpec.groovy
Expand Up @@ -35,16 +35,18 @@ import spock.lang.Specification
* Whereas methods can only be filtered based on annotations, classes can
* also be filtered based on their base class.
*
* <p>If you directly want to see the effect of different Spock configurations,
* just run this spec from your IDE with an additional VM parameter
* <li>
* <ul><tt>-Dspock.configuration=IncludeFastConfig.groovy</tt> or</ul>
* <ul><tt>-Dspock.configuration=ExcludeSlowConfig.groovy</tt></ul>
* </li>
*
* <p>See also the two corresponding resource files provided with this spec.
*
* @since 0.4
*/
class IncludeExcludeExtensionSpec extends Specification {
static {
System.setProperty "spock.configuration", "IncludeFastConfig.groovy"

// Alternatively, try this:
// System.setProperty "spock.configuration", "ExcludeSlowConfig.groovy"
}

@Fast
def "a fast method"() {
expect: true
Expand Down

0 comments on commit 043ef13

Please sign in to comment.