Make fails_with available in spec blocks

Closes #31706.
Move conditional fails_with annotations to spec blocks