Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/initializers/session_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
client: REDIS_SESSION_POOL_WRAPPER,
},
on_session_load_error: SessionEncryptorErrorHandler,
on_redis_down: proc { |error, _env, _sid| raise error },
serializer: SessionEncryptor.new,
)
12 changes: 12 additions & 0 deletions spec/requests/redis_down_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'rails_helper'

RSpec.describe 'redis down session error handling' do
context 'with bad Redis connection' do
it 'fails loudly' do
allow(REDIS_SESSION_POOL_WRAPPER).to receive(:setex).and_raise(Redis::CannotConnectError)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

expect do
get forgot_password_path
end.to raise_error(Redis::CannotConnectError)
end
end
end