LicenseHelper uses "extend self" inapproriately
LicenseHelper module has a number of methods that use instance variables for memoization, or refer to
@project. At the end of the module,
extend self is called, encouraging its use as, e.g.,
LicenseHelper.show_promotions?(current_user) in controllers.
Unfortunately, the memoization is stored in the module itself for these calls (so
LicenseHelper.instance_variable_get("@show_promotions") returns the value), rather than in any instances. So it's cached for the life of the process - whether that's unicorn or a spec run.
We need to untangle this module and clearly separate out methods that will work when
self == LicenseFinder from those that won't.
I'll remove memoization for
show_promotions? in !2776 (merged) as that is definitely incorrect - it doesn't take account of the passed-in user, for instance.