Add factory girl

Added factory girl and refactored code so that it uses factory girl.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.