I will claim no expertise on the matter, but the summaries I've read do seem to indicate bear spray is more effective than a gun (statistically). Obviously there are lots of variables. Many people seem to think of the .44 Magnum as a very formidable handgun but realistically it's a pop gun vs a large bear. How many shooters have the skill to drop a bear moving 30 mph with a handgun? I consider myself pretty skilled with firearms (Dad had an FFL and sold guns thru his sports club when I was young, and we had 80 personal firearms in our household) but I wouldn't feel great at all about facing an angry bear with a handgun. A person with limited training with a handgun would probably be much better off with a canister of bear spray. For a skilled shooter with a 12 gauge (with appropriate ammo) maybe the gun would be better. Of course, if the pepper spray works it's a win/win situation, whereas if the gun works it's win/lose.
_________________________
“I'd rather have questions that cannot be answered than answers that can't be questioned.” —Richard Feynman