Tests refactoring. Added logger. Added FactoryGirl for tests.