LDAP: Fix attempted modification of frozen hash (#39571)

This commit is contained in:
David Roetzel authored and Claire committed 2026-06-23 17:35:29 +02:00
1 parent 4f425d9b77
commit b06e9f5a5e
2 files changed
+42 -1

No files matched your search

@@ -0,0 +1,41 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe User::LdapAuthenticable do
describe '::ldap_options' do
subject { User.ldap_options }
it 'returns a hash' do
expect(subject).to be_a Hash
end
context 'when `Devise.ldap_method` is `simple_tls`' do
before do
Devise.ldap_method = :simple_tls
end
after do
Devise.ldap_method = nil
end
it 'includes `encryption` key' do
expect(subject).to have_key :encryption
end
context 'when `Devise.ldap_tls_no_verify` is set to `true`' do
before do
Devise.ldap_tls_no_verify = true
end
after do
Devise.ldap_tls_no_verify = false
end
it 'sets `verify_mode` correctly' do
expect(subject[:encryption][:tls_options][:verify_mode]).to eq OpenSSL::SSL::VERIFY_NONE
end
end
end
end
end