How to login using serverspec using ssh key?
serverspec is using this Ruby class to ssh to servers

One should set the path to the key into the ~/.ssh/config file:

Host X
    HostName X
    User Y
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/Z


Now rake spec runs the test on the server.