In many of our classes we cache expensive operation for performance. e.g.
def self.foo
@foo ||= get_foo
end
This works great in the application, however the tests (RSpec) fail because of these memoized variables. The values from the first test are being returned in the subsequent tests, when we expect fresh values.
So the question is: how do I reload the class? Or remove all the memoized variables?