Using factory instead of constructor for better testing
Adding test for logIn method