refactoring and started Rails tests