You can just check the connection:
it "belongs to a user" do
ride = Ride.new
user = User.new
user.rides << ride
expect(ride.user).to be user
end
In this context, the match bechecks for the identifier of the object. Thus, this will happen if and only if the object userhas the same object_id. In this case, this is what you want, and has semantically significant meaning in how it is read.