I've had no dog attacks while riding, a few dog chases though, and all the dog chases ended once I stopped, and not further fueling their chase instinct.
OP, keep a vigilant eye out in that same area if you are not able to find a reasonable alternate route to travel, and not let the dog sneak up upon you. Did you report your incident to authorities? Personally, I'd stick with the pepper spray, since it did stop the confrontation, and use of a firearm could lead to even more personal grief.
__________________
Prisoner No. 979