Skip to content

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

@ianheggie

Description

@ianheggie

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions