Define user

Duplicates #18 and adds spec tests.