Skip to content

Conversation

@ashwin47
Copy link

Summary

  • Configure config.action_controller.cache_store = :memory_store so rate limiting works in tests
  • Clear the cache in IntegrationTest setup to prevent state leaking across tests
  • Update join_codes_controller_test to stub the correct cache store

Context

Rails uses config.cache_store for rate limiting by default. Since test environment uses :null_store, rate
limiting was silently disabled. See rails/rails#56183.

By default, Rails uses the cache_store for rate limiting. Since the test
environment uses :null_store, rate limiting was silently disabled in tests.

This configures a separate :memory_store for action_controller.cache_store
so rate limiting actually works in tests. The cache is cleared in the
IntegrationTest setup to prevent rate limit data from persisting across tests.

Also updates the join_codes_controller_test to stub the correct cache store.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ajaychandrak2002-bit
Copy link

not much limiting works to do

  • config.action_controller.cache_store = :memory_store*

@zzak
Copy link

zzak commented Jan 2, 2026

It's not recommended to change it globally, I think that commit maybe misleading and I will fix it. Because tests that hit the cache using an in-memory store will be slower than using a nullstore for no reason whatsoever, if they are not depending on the persisted cache behavior.

The point was meant to be if your testing that behavior should you enable it...

@ashwin47 ashwin47 closed this Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants