Q:

How was the Torah written by Moshe (were there spaces)?

Someone told me that before Ezra Hasofer the Torahs did not have spaces (he said that according to some opinions not even between words).
It was just given over when learned where the parshas (paragraphs) were and if they were setuma (now Separated by a space) or pesucha (now on a separate line).
I am looking for sources for this (if it is true) and other opinions on this matter.
Related: Which alphabet were the original Torah scrolls in?
I always thought that the Torah was given on Har Sinai with the spaces.
Even though I showed him Rambam Hilchot Tefilin 7:11 he still said that it was Ezrah who decided for there to be spaces.

וכל הדברים האלו למצוה מן המובחר ואם שינה לא פסל. אבל אם כתב המלא חסר או החסר מלא. או שכתב מלה שהיא קרי וכתב כקריאתה כגון שכתב ישכבנה במקום ישגלנה ובטחורים במקום ובעפולים וכיוצא בהן. או שכתב פרשה פתוחה סתומה או סתומה פתוחה. או שכתב השירה כשאר הכתב. או שכתב פרשה אחת כשירה הרי זה פסול ואין בו קדושת ספר תורה כלל אלא כחומש מן החומשין שמלמדין בה התינוקות

From 
http://m.chabad.org/library/article_cdo/aid/925429/jewish/Tefillin-Mezuzah-and-Sefer-Torah-Chapter-Seven.htm

All the above matters [were mentioned] only because this is the most perfect way of performing the mitzvah. If one deviated from them, [the scroll] is not disqualified. In contrast, if one wrote the short form of a word that should be spelled using a long form, or the long form of one that should be spelled using a short form, [the scroll] is disqualified. [The same ruling applies if, in circumstances where one word is written in the Torah scroll and a different word is read] - e.g.,yishkavenah is read instead of yishgalenah (Deuteronomy 28:30), and uvat'chorim is read instead of uva'folim (Deuteronomy 28:27) - one writes the word that is read [instead of the word that is written]. Similarly, if one wrote a passage that should be p'tuchah as s'tumah, or one that should be s'tumah as p'tuchah, or if one wrote another passage from the Torah in the form of one of the songs, or wrote one of the songs in the form of another passage, [the scroll is disqualified]. It does not have the holiness of a Torah scroll and, instead, is considered as one of the chumashim from which children are taught.

A:

This video references what may be the source of this misconception:
הקדמת רמב"ן לספר בראשית

שהיתה הכתיבה רצופה בלי הפסק תיבות, והיה אפשר בקריאתה שתקרא על דרך השמות, ותקרא על דרך קריאתנו בענין התורה והמצוה, ונתנה למשה רבינו על דרך קריאת המצות, ונמסר לו על פה קריאתה בשמות

My translation attempt:

The writing was continous without spaces, so it was possible [to put the spaces and thus] to read it as names or as the Torah and the Mitzvah. And, it was given to Moshe Rabbeinu with the spaces for the mitzvot, and how to read the names was transmitted to him orally.

