Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `read_ber' for TCR::RecordableTCPSocket #42

Open
ianheggie opened this issue Feb 15, 2023 · 0 comments
Open

Comments

@ianheggie
Copy link

ianheggie commented Feb 15, 2023

I am using

  • gem 'tcr', github: 'robforman/tcr', tag: 'cf6b949ba0d98538bf6b3df0373001ef9ec3ef06' ie branch ruby-upgrade in Gemfile
  • ruby version: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
  • rails version: 7.0.4.2
  • net-ldap 0.17.1

The error is:

Minitest::UnexpectedError: NoMethodError: undefined method `read_ber' for #<TCR::RecordableTCPSocket:0x00007f70f20f9d20 @read_lock=#<Thread::Queue:0x00007f70f20f9c80>, @recording=[["write", "...some stuff..."]], @live=true, @socket=#<TCPSocket:(closed)>>

        socket.read_ber(syntax) do |id, content_length|
              ^^^^^^^^^
Did you mean?  read_nonblock
    app/models/user.rb:55:in `ldap_client'

The code that is calling (app/models/user.rb) reads as follows:

  def self.ldap_client(user_name, password)
    auth = { method: :simple, username: sanitize_email(user_name), password: password }
    ldap = Net::LDAP.new(
      host: AD_HOST,
      auth: auth
    )
    # debugger
    ldap if ldap.bind  # Error thrown on bind (line 55)
  end

my test/test_helper.rb includes:

TCR.configure do |c|
  c.cassette_library_dir = File.expand_path('cassettes/tcr', __dir__)
  # ldap            389/tcp
  # ldaps           636/tcp
  c.hook_tcp_ports = ENV['DISABLE_TCR'].present? ? [] : [389, 636]
  if ENV['TCR_MODE'] =~ /rec/i
    c.hit_all = true
  end
end

FYI

  • It also reports an deprecation warning:
/home/vagrant/.gem/ruby/3.1.3/bundler/gems/tcr-cf6b949ba0d9/lib/tcr/cassette.rb:19: warning: File.exists? is deprecated; use File.exist? instead
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

No branches or pull requests

1 participant