You did the fight,you wouldn't receive the badge without fighting and also if you get disconnected/refresh during the time your in a gym it will automatically teleport you to pokemon center,maybe your pokes were out and they fought Erikas poke but you didn't get the notification for some reason?