rspec 3 – stub a class method December 24, 2022 by Tarik You should do allow(MyMod::Utils).to receive(:find_x).and_return({something: 'testing'}) Check out the doco Method stubs.