Fix code to take both if and unless into account
Refactor tests for helper