Skip to main content

Command Palette

Search for a command to run...

Clear memoized value during request specs

Updated
1 min read

There might be times when your @current_user instance variable gets re-used between multiple requests in your rspecs. This might result in strange test behaviours resulting in test failings. Just clear the cache completely.

Rails.cache.clear

More from this blog

Tenzin Chemi

15 posts

Software writer out of curiosity. 322D 9687 C273 50CE 5F39 7A03 0D27 F9C6 BDAF B6D3