I have had the same problems many have reported here with the hit and miss connectivity to WiFi, with it failing with the message indicating the WiFi has no connection to the internet, when in fact it does.
Since I changed one of my home APs to have the DHCP respond with Google's own 8.8.8.8 and 8.8.4.4 DNS server addresses, the problem has gone away and working fine.. It now even works through my ATT UVerse router/Wireless AP which has the DNS addresses hard coded to ATT own DNS Servers.
I have read that AT&T's UVerse land line internet requires the Gateway DHCP to respond with their own 99.99.99.53 and 99.99.99.153 DNS Service for some functions to initiate and why it's hard coded in the modems, but that is a fixed point to point service..
What were they thinking in Android v5.0.1????