Skip to content


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

deiga opened this Issue · 3 comments

4 participants


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


Can you put together some example code demonstrating this?


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 xaviershay closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.