rewrote tests with connect_to function