Fixed error test

Needed to specify which error in the spec. Fixed code so it works properly with the correct error now