I can't reproduce the failure with a slightly simplified version. class User attr_accessor :name
def invoke_additional_tasks(test) { success: true } end private class << self def validate_something(params) { success: true } end end end RSpec.describe User do describe 'test_method' do context 'when validate_something returns success' do before(:each) do allow(User).to receive(:validate_something).and_return(success: true) end it 'should invoke_additional_tasks on user' do expect_any_instance_of(User).to receive(:invoke_additional_tasks).with('test_method') user = User.new user.name = "test#{rand(1..1000000)}" user.invoke_additional_tasks('test_method') end end end end -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to rspec+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/CAAk5Ok_9WcF34QisqBk%2BrtRuZafyDTdU-cn5CLzR_G1BHWGR0g%40mail.gmail.com.