The Meaning of Life, the Universe, and Everything.
I was confused as to whether or not mobs would be able to spawn on rails. I came across this in my world and was curious why I was finding mobs on top of rails when they are not supposed to be able to walk on top of them. So, I ran a test to see if the mobs were just spawning there, not walking over them. Here's what I found:
If you tried the second test (a Superflat world covered with rails) in 1.7 or earlier no mobs would spawn since back then a pack of mobs required an actual air block (not just a transparent non-solid block) in order to spawn, although individual mobs can spawn in them (the first test has air blocks adjacent to the rail-covered blocks; these air blocks do not have to be above a solid surface). Thus, this was not much of an issue prior to 1.8 as long as there were no valid spawning spaces near your rails:
Note that in a 1.9 snapshot they made it so that mobs can't spawn on rails at all so this will no longer be an issue regardless of how you make your rails (mobs can still be pushed onto them).