Sha256: 89d4ef4d68fe65f2568a0f12d511655c21a513bfce6267794da1b2e1393cb2b6

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

require "spec_helper"

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

2 entries across 2 versions & 1 rubygems

Version Path
metasploit_data_models-1.0.0.pre.rails.pre.4.0b spec/lib/ipaddr_spec.rb
metasploit_data_models-1.0.0.pre.rails.pre.4.0a spec/lib/ipaddr_spec.rb