Refactor specs and move isAvailable specs into a shared function