FIX: randomly failing user_spec (PR #9754)

When we evaluate update_last_seen! we relay on Redis to not run that code too often

The problem is that not all specs which are running update_last_seen! are cleaning after themselves

    after do

For examples specs in that block

So it can be replicated when you run a few times bundle exec rspec ./spec/models/user_spec.rb -e "should not update the first seen value if it doesn't exist" -e "should have 0 for days_visited"

We should flush Redis after each spec which is evaluating update_last_seen!


The title of this pull request changed from “FIX: randomly falling user_spec” to "FIX: randomly failing user_spec

I worry a bit about flushall, I wonder if we can be more explicit, at least the test is aware of exactly what it mucked with… I guess I am okish with this cause we do it elsewhere

@SamSaffron you are right, it may create random failure somewhere else. Let me fix it to drop that specific key

1 Like