Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
notes for stimulus_reflex + Rspec


I want to use Rspec to build feature specs that test SR pages, just like normal web pages.

Therefore, I expect Capybara + Rspec to be able to do things like:

visit login_path
fill_in 'Email', with:
fill_in 'Password', with: user.password + 'BAD'
expect(page).to have_content('That email or password is not correct')


After installing gems, setting up redis, etc. I wrote my first non-SR test, which worked, but outputted the following to the console, cluttering my rspec window:

WARNING: Stimulus Reflex requires caching to be enabled. Caching allows the session to be modified during ActionCable requests.
To enable caching in development, run:
    rails dev:cache

To fix, I edited two lines in test.rb:

  config.action_controller.perform_caching = true
  config.cache_store = :memory_store

Which made the error go away and let me run my spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment