Use new syntax here: `allow(::Resolv).to receive(:getname).and_raise(...)`, see [the doc](https://relishapp.com/rspec/rspec-mocks/v/3-0/docs/method-stubs).  It's consistent with `expect(...)` below.

And actually using `expect()` instead of `allow()` migth be better as you test that the resolving is really called.