Pepper spray is great stuff for that bear that wanders into camp for your garbage, or that bear that puffs up with a threat display. You squirt them and they turn inside out to get away.
When a bear is ACTUALLY attacking, it's lightning fast. You aren't going to have time to pull out your pepper spray, pop off the safety cap and squirt it into his face.
You need to rely on what is in your hands. If you're hunting, that's a rifle. And that's why I recommend a low power variable. It will be at close range and if you have a 3x9 or 4x12 you will be absolutely blind at close range.
If you can't hit a deer with a 1x5, you shouldn't be hunting.