Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/spec/lib/rex/proto/dns/upstream_resolver_spec.rb
Views: 11788
# -*- coding:binary -*-1require 'spec_helper'234RSpec.describe Rex::Proto::DNS::UpstreamResolver do5context 'when type is black-hole' do6let(:type) { Rex::Proto::DNS::UpstreamResolver::Type::BLACK_HOLE }7let(:resolver) { described_class.create_black_hole }89describe '.new_black_hole' do10it 'is expected to set the type correctly' do11expect(resolver.type).to eq type12end1314it 'is expected to set the destination correctly' do15expect(resolver.destination).to be_nil16end17end1819describe '#to_s' do20it 'is expected to return the type as a string' do21expect(resolver.to_s).to eq type.to_s22end23end24end2526context 'when type is dns-server' do27let(:type) { Rex::Proto::DNS::UpstreamResolver::Type::DNS_SERVER }28let(:destination) { '192.0.2.10' }29let(:resolver) { described_class.create_dns_server(destination) }3031describe '.new_dns_server' do32it 'is expected to set the type correctly' do33expect(resolver.type).to eq type34end3536it 'is expected to set the destination correctly' do37expect(resolver.destination).to eq destination38end39end4041describe '#to_s' do42it 'is expected to return the nameserver IP address as a string' do43expect(resolver.to_s).to eq destination44end45end46end4748context 'when type is static' do49let(:type) { Rex::Proto::DNS::UpstreamResolver::Type::STATIC }50let(:resolver) { described_class.create_static }5152describe '.new_static' do53it 'is expected to set the type correctly' do54expect(resolver.type).to eq type55end5657it 'is expected to set the destination correctly' do58expect(resolver.destination).to be_nil59end60end6162describe '#to_s' do63it 'is expected to return the type as a string' do64expect(resolver.to_s).to eq type.to_s65end66end67end6869context 'when type is system' do70let(:type) { Rex::Proto::DNS::UpstreamResolver::Type::SYSTEM }71let(:resolver) { described_class.create_system }7273describe '.new_system' do74it 'is expected to set the type correctly' do75expect(resolver.type).to eq type76end7778it 'is expected to set the destination correctly' do79expect(resolver.destination).to be_nil80end81end8283describe '#to_s' do84it 'is expected to return the type as a string' do85expect(resolver.to_s).to eq type.to_s86end87end88end89end909192