Sha256: 10aad8e926907ec5778d0fce053161f67be45d5f3c40ccc69bd056c2ef6e6574

Contents?: true

Size: 1 KB

Versions: 8

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'
HostResponse = Struct.new(:body)
describe Infoblox::Host, "#add_ipv4addr" do
  it "adds an address correctly" do
    host = Infoblox::Host.new
    host.add_ipv4addr("10.10.10.10")
    host.add_ipv4addr("10.10.10.12")
    host.ipv4addrs[0].should be_a(Infoblox::HostIpv4addr)
    host.ipv4addrs[0].ipv4addr.should eq("10.10.10.10")
  end

  it "posts correctly" do
    conn = double
    uri = Infoblox::BASE_PATH + Infoblox::Host.wapi_object

    allow(conn).to receive(:post).with(uri, {
      :ipv4addrs => [{:ipv4addr => "10.10.10.10"}, 
                     {:ipv4addr => "192.168.1.1", 
                      :mac => "109coic0932j3n0293urf"}],
                      :name => "test-server.test.ing"
      }).and_return(HostResponse.new("\"hey\""))

    h = Infoblox::Host.new(:connection => conn)
    h.add_ipv4addr("10.10.10.10")
    h.ipv4addrs=([{:ipv4addr => "192.168.1.1", :mac => "109coic0932j3n0293urf"}])
    h.name = "test-server.test.ing"
    h.post
    h._ref.should eq("hey")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
infoblox-0.2.19 spec/host_spec.rb
infoblox-0.2.18 spec/host_spec.rb
infoblox-0.2.17 spec/host_spec.rb
infoblox-0.2.15 spec/host_spec.rb
infoblox-0.2.14 spec/host_spec.rb
infoblox-0.2.13 spec/host_spec.rb
infoblox-0.2.12 spec/host_spec.rb
infoblox-0.2.11 spec/host_spec.rb