Fix reference to undefined local variable

The spec is passing incorrectly so I updated it to check the error message.