I agree with the answers that—
- one should either use a space before and after an em-dash or no space around the em-dash and
- one's stylebook is the final authority to decide if there should be a space before and after an em-dash or no space around the em-dash.
But going by the way how a text, when typed in a word file, goes to the next line, I would argue that there should be no space around the em-dash. Just suppose, how a text would look like when the text goes to the next line after we put a space before or after an em-dash:
xxx xxxxx xxxx x xxxxx xxxx xxx xxx xxx xxxx xxx xxx xxx xxx. School is based on the three R’s — reading, writing, and ’rithemtic.
In the example above, "R's" and the three items ("reading, writing, and ’rithemtic") that elucidate "R's" constitute a single unit. In the example above, because of the space, the unit breaks and the readability is impaired when "R's" remains in the preceding line and the three items go to the next line. Worse still, the second line in the example starts with no word but a punctuation mark, em-dash. In fact, in the example above, the spaces around "R's" result in a utter disconnect between the two parts of the unit and take away continuity of the reading.
None of the above problems will, however, come, if the spaces around the em-dash are removed.