'Expect and Allow are not stubbing Singleton methods
I have an Utils class that looks something like this
module A
class Utils
class << self
def foo(arg)
return arg
end
end
end
end
And I'm trying to stub the foo method but both allow and expect don't work and the method is called either way, what am I doing wrong on my spec?
I tried stubbing by doing
allow(A::Utils).to receive(:foo).and_return("test")
expect(A::Utils).to receive(:foo).and_return("test")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
