Refactor tests with before block