changes permalink check to the model and adds some specs