Senator Ted Cruz of Texas has been compared to animated character Homer Simpson in an attack ad from an environmental group.