Move classes into spec context and undefine after spec ends
Add specs for restrict_with_error case
Ensure block code still works