Improve formatting of hook function in spec