Forgus / spock

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

Spock + Spring - using helper methods in where clause that use spring injected beans skips test #280

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Tests are skipped (i.e not recognized as spock tests) when using helper methods 
in a where-clause that use spring injected beans.

Example:

@ContextConfiguration("classpath:some-spring.xml")
class SomeSpec extends Specification {

    @Resource testdata
    @Autowired someService

    def "a feature"() {
        expect:
        someService.login(user) == true

        where:
        user                    | comment
        getAdmin()          | "Admin has access"
        getRegularUser() | "Regular users have access" 
    }

   def getAdmin() {
        testData.getAdmin()
   }

   def getRegularUser() {
        testData.getRegularUser()
   }

}

What version of Spock and Groovy are you using?
Spock version 0.7-groovy-2.0
Spock-spring version 0.7-groovy-2.0
Groovy version 2.0.5
Running in Intellij idea 11.1.3

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

Since these tests are just skipped, it is hard to find out why they are 
failing. If possible; it would be nice if an error message would be raised.

Original issue reported on code.google.com by odin.hol...@gmail.com on 7 Nov 2012 at 2:27