tests: extract common formula helper
Add tests for Formula#installed_prefix