I have a Spock integration test that looks something like this:
class PriceTierControllerIntegrationSpec extends IntegrationSpec {
PriceTierController controller
def setup() {
controller = new PriceTierController()
}
def "applyDiscount() method will redirect user to success view"() {
when:
controller.applyDiscount()
then:
controller.response.redirectedUrl == '/priceTier/success'
}
Then in the controller, the logic is simply:
class PriceTierController {
def applyDiscount() {
redirect action: 'success'
}
def success() {
}
}
When I run this Spock test on my local machine, the test passes. However, on the build server, I get the following error:
controller.response.redirectedUrl == '/priceTier/success'
| | | |
| | /test/success false
| | 8 differences (46% similarity)
| | /(t---)e(st--)/success
| | /(pric)e(Tier)/success
| org.codehaus.groovy.grails.plugins.testing.GrailsMockHttpServletResponse@dc42543
com.test.PriceTierController@193d6547
For some reason, on the build server, the Spock test thinks that the controller name is test
instead of priceTier
, and the test will fail. This only seems to happen for Spock integration tests, as the Spock unit tests and a few legacy Grails mixin tests all pass fine.
Does anybody know what could be causing this problem?