diff --git a/lib/net/smtp/authenticator.rb b/lib/net/smtp/authenticator.rb index 75350f0..756bfa9 100644 --- a/lib/net/smtp/authenticator.rb +++ b/lib/net/smtp/authenticator.rb @@ -6,11 +6,13 @@ def self.auth_classes end def self.auth_type(type) + type = type.to_s.upcase.tr(?_, ?-).to_sym Authenticator.auth_classes[type] = self end def self.auth_class(type) - Authenticator.auth_classes[type.intern] + type = type.to_s.upcase.tr(?_, ?-).to_sym + Authenticator.auth_classes[type] end attr_reader :smtp diff --git a/test/net/smtp/test_smtp.rb b/test/net/smtp/test_smtp.rb index 4467e7b..85bc1bc 100644 --- a/test/net/smtp/test_smtp.rb +++ b/test/net/smtp/test_smtp.rb @@ -485,7 +485,7 @@ def test_start_auth_cram_md5 omit "openssl or digest library not loaded" unless defined? OpenSSL or defined? Digest port = fake_server_start(auth: 'CRAM-MD5') - Net::SMTP.start('localhost', port, user: 'account', password: 'password', authtype: :cram_md5){} + Net::SMTP.start('localhost', port, user: 'account', password: 'password', authtype: "CRAM-MD5"){} port = fake_server_start(auth: 'CRAM-MD5') assert_raise Net::SMTPAuthenticationError do