Foo.should_receive(:bar).and_call_original fails with Rails.cache #249

deiga opened this Issue Mar 24, 2013 · 3 comments


None yet
4 participants

deiga commented Mar 24, 2013

If I have a should_receive expectation to a function which is cached then the test fail with the error singleton can't be dumped

I need to Rails.cache.stub(:write) to make my tests succeed again.

Is there any other way to correct that than this workaround, could we fix this in rspec's code?

Source for my workaround is this tweet

OSX 10.8.3, Ruby 2.0.0


myronmarston commented Mar 24, 2013

Can you put together some example code demonstrating this?


JonRowe commented Mar 27, 2013

This sounds plausible to me, I'm not sure I'd expect Rails to be able to cache message expectations.

As @myronmarston says, can you provide the spec's you attempted to write? Then we might be able to help figure out wether this is a bug, or suggest an alternative way to spec this.


xaviershay commented Oct 1, 2013


xaviershay closed this Oct 1, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment