Is there a way to follow a redirect url while doing integration testing in grails?

59 Views Asked by At

I am using grails 2.2

An integration test looks like this

reservationController.params["participant"] = ["firstName": "Hello", "lastName": "Hello", "gender": "MALE", 'phone': '1234567890','email': '[email protected]']

def mm = reservationController.save(m.sale.id)

Inside the save method of reservation contoller is a redirect at the end

    redirect(action: "referral", id: sale.id)

It seems like when i run integration test, after calling save it will not follow the redirect to 'referral'. When i add a breakpoint after reservationController.save() and then inspect reservationController.response.redirectedUrl then it shows the redirect url but it doesnt go to the redirected url.

Is there a way to follow the redirect url? i.e when i call .save on reservation controller it will complete the save method and also go to the redirected url and only it will return the model that the redirected url returns.

I appreciate any help.

0

There are 0 best solutions below