That's because when #url is called for an object (like in the tests) #signature is called for a second time. The first call of signature results in params[:path] == "hostname/subdomain/object", but the second call in "hostname/hostname/subdomain/object".