In many of our classes, we cache expensive work for performance. eg.
def self.foo
@foo ||= get_foo
end
This works fine in the application, however tests (RSpec) fail due to these memoized variables. Values from the first test are returned in subsequent tests when we expect fresh values.
So the question is: how do I reload the class? Or delete all noticed variables?
source
share