using shared examples in spec and removing unnecessary iteration