Extract stderr isolation to helper

This is useful when we want to generate warnings without being penalised by the stderr splitter.
Simply using `allow(::Kernel).to receive(:warn)` doesn't always seem to work (1.8.7)