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