Sha256: 3e268fe0b2a3b28d46da35c9a44c22e4967898ed7c7042b0fabc1c75744e3bac

Contents?: true

Size: 937 Bytes

Versions: 1

Compression:

Stored size: 937 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'whois/server/adapters/arin'

describe Whois::Server::Adapters::Arpa do
  let(:definition) { [:tld, ".in-addr.arpa", nil, {}] }

  describe "#lookup" do
    it "returns the WHOIS record" do
      server = described_class.new(*definition)
      expect(Whois::Server::Adapters::Arin.query_handler).to receive(:call)
        .with("n + 229.128.in-addr.arpa", "whois.arin.net", 43)
        .and_return(response = "Whois Response")

      record = server.lookup("229.128.in-addr.arpa")
      expect(record.to_s).to eq(response)
      expect(record.parts).to eq([Whois::Record::Part.new(body: response, host: "whois.arin.net")])
    end

    it "discards newlines" do
      server = described_class.new(*definition)

      expect do
        server.lookup("229.128.in-addr.arpa\nextra")
      end.to raise_error(Whois::ServerError, "Invalid .in-addr.arpa address")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whois-6.0.0 spec/whois/server/adapters/arpa_spec.rb