To mock a class method:
allow(Time).to(receive(:utc).and_return(
Time.now.utc.change(hour: 9, minute: 0)
))
To mock any class instance method:
allow_any_instance_of(Time).to(receive(:utc).and_return(
Time.now.utc.change(hour: 9, minute: 0)
))
To reset for next test:
allow_any_instance_of(Time).to(receive(:utc).and_call_original