Betamax is not recording calls to RESTClient in Grails

139 Views Asked by At

I have a Betamax test that I'm trying to configure to intercept calls to a web service that is using RESTClient. The calls to the web service aren't getting recorded. My test code looks like this:

@Betamax(tape = 'pending_transfer_success')
        void "test createPendingTransfer"() {
            BetamaxRoutePlanner.configure(restClient.client)
            BetamaxHttpsSupport.configure(restClient.client)

            when:
            Transfer transfer = service.createPendingTransfer(
                    beneficiaryFirstName, beneficiaryLastName, beneficiaryUserEmail, lineItemsIdsToTransfer)

            then:
            ...
    }

Inside the setup() method I'm configuring the RESTClient like so:

restClient = new RESTClient("${grailsApplication.config.acme.account.api.url}/")
service.restClient = restClient

The app is a Grails 2.2.3 app and the test is written using Spock. Any help explaining why the calls isn't being recorded would be greatly appreciated.

0

There are 0 best solutions below