Sha256: 6def4e019bec6f5bbf42dbfe266e68eea488cbd5c754868ea2309c0e4f68c624

Contents?: true

Size: 777 Bytes

Versions: 64

Compression:

Stored size: 777 Bytes

Contents

RSpec.describe IPAddr do
  subject(:ip_address) { IPAddr.new('10.0.0.1') }
  
  describe '#==' do
    it { is_expected.to be == '10.0.0.1'}
    it { is_expected.to be == IPAddr.new('10.0.0.1')}
    it { is_expected.not_to be == 'foo'}
    
    it 'does not raise an error when compared to a non ip address' do
      expect {
        ip_address == 'foo'
      }.to_not raise_error
    end
  end
  
  describe '#include?' do
    subject(:ip_range) { IPAddr.new('10.0.0.1/24') }
    it { is_expected.to include '10.0.0.1'}
    it { is_expected.to include ip_address}
    it { is_expected.not_to include 'foo'}
    
    it 'does not raise an error when checking for a non ip address' do
      expect {
        ip_range.include? 'foo'
      }.to_not raise_error
    end
  end
  
end

Version data entries

64 entries across 64 versions & 2 rubygems

Version Path
metasploit_data_models-4.0.1 spec/lib/ipaddr_spec.rb
metasploit_data_models-4.0.0 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.10 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.9 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.8 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.7 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.6 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.5 spec/lib/ipaddr_spec.rb
metasploit_data_models-2.0.17 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.4 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.2 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.1 spec/lib/ipaddr_spec.rb
metasploit_data_models-3.0.0 spec/lib/ipaddr_spec.rb
metasploit_data_models-2.0.16 spec/lib/ipaddr_spec.rb
metasploit_data_models-2.0.15 spec/lib/ipaddr_spec.rb
metasploit_data_models-2.0.14 spec/lib/ipaddr_spec.rb
metasploit_data_models-2.0.13 spec/lib/ipaddr_spec.rb
metasploit_data_models-2.0.12 spec/lib/ipaddr_spec.rb
metasploit_data_models-2.0.11 spec/lib/ipaddr_spec.rb
metasploit_data_models-2.0.10 spec/lib/ipaddr_spec.rb