Ratpack allows you unit test handlers using
GroovyRequestFixture class. The good thing about this approach is that it does not require running the whole application and you can quickly test if the handler does what you expect. However, if you retrieve objects from Raptack’s registry you will run into a problem - registry in this case is empty.
Recently I have answered a few questions on Stack Overflow related to Groovy scripts and how they work in combination with closures and delegated objects. Some of use cases may not be intuitive and today I’m gonna show you one of them and explain what happens under the hood.
This blog post is inspired by one of my recent Stack Overflow answers to following question: Grails: why is the Config.groovy file executed during compilation?. Here I’m going to show you step by step what makes
grails package command executing
Config.groovy script and how I’ve managed to find the answer to that question.