multi-tenant / grails-multi-tenant-single-db

Multi Tenant implementation for single database environments - Use grails-filtering and grails-hibernate-hijacker
Apache License 2.0
32 stars 25 forks source link

withoutTenantRestriction not recognized by unit tests #48

Open tbuchwalter opened 7 years ago

tbuchwalter commented 7 years ago

I'm trying to write unit test for existing code (backwards approach, I know) and when I am using My_domain.withoutTenantRestriction{ // code here }

to query the table regardless of current user's tenant I get errors in my tests that: groovy.lang.MissingMethodException: No signature of method: com.sexingtechnologies.bullseye2.Location.withoutTenantRestriction() is applicable for argument types: (com.mypackage.orders.OrderManageController$_loadOrderManageDetails_closure5) values: [com.mypackage.orders.OrderManageController$_loadOrderManageDetails_closure5@ff47cbc] with additional stack trace errors.

I've tried to use My_domain.metaClass.withoutTenantRestriction{ Closure closure -> closure.call()} but it still fails with the same errors.

How can I get the grails test-app to recognize this dynamic method / closure so that I can write my tests?