Sha256: b8c0ff7299ca921a8b535b7beb73ab17a1c3996fa161890ccd409030189584fe

Contents?: true

Size: 1.03 KB

Versions: 19

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

RangeResponse = Struct.new(:body)

describe Infoblox::Host, "#next_available_ip" do  
  it "returns empty array when no IP is available." do
    connection = double
    uri = Infoblox.base_path + Infoblox::Range.wapi_object
    return_json = RangeResponse.new('{"ips": "[]"}')
    allow(connection).to receive(:post).with(uri + "?_function=next_available_ip" , {:num=>1, :exclude=>[]}).and_return(return_json)
    response = Infoblox::Range.new(:connection => connection)
    expect(response.next_available_ip).to eq '[]'
  end

  it "gets next available ip from range" do
    connection = double
    uri = Infoblox.base_path + Infoblox::Range.wapi_object
    return_json = RangeResponse.new('
      {
        "ips": "[\"1.1.1.1\", \"1.1.1.2\"]"
      }')
    allow(connection).to receive(:post).with(uri + "?_function=next_available_ip" , {:num=>1, :exclude=>[]}).and_return(return_json)
    response = Infoblox::Range.new(:connection => connection)
    expect(response.next_available_ip).to eq '["1.1.1.1", "1.1.1.2"]'

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
infoblox-3.0.0 spec/range_spec.rb
infoblox-2.0.5 spec/range_spec.rb
infoblox-2.0.4 spec/range_spec.rb
infoblox-2.0.3 spec/range_spec.rb
infoblox-2.0.2 spec/range_spec.rb
infoblox-2.0.1 spec/range_spec.rb
infoblox-2.0.0 spec/range_spec.rb
infoblox-1.0.1 spec/range_spec.rb
infoblox-1.0.0 spec/range_spec.rb
infoblox-0.5.3 spec/range_spec.rb
infoblox-0.5.2 spec/range_spec.rb
infoblox-0.5.1 spec/range_spec.rb
infoblox-0.5.0 spec/range_spec.rb
infoblox-0.4.1 spec/range_spec.rb
infoblox-0.4.0 spec/range_spec.rb
infoblox-0.3.3 spec/range_spec.rb
infoblox-0.3.2 spec/range_spec.rb
infoblox-0.3.1 spec/range_spec.rb
infoblox-0.3.0 spec/range_spec.rb