Sha256: f9a0083e90e5ae4fda186c5745f9198740d338846891f98508c47dc4f62d8c31

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# -*- encoding: utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Simplenet::Client::AnycastIp do
  before(:all) do
    @conf = {:url => "http://localhost:8081"}
    @conn = Simplenet::Client::Connection.new(@conf)

    @cidr = random_cidr
    @anyc = @conn.anycasts.create(@cidr)["id"]
  end

  subject { @conn.anycastips }

  before do
    @anycastip = random_ip(@cidr)
  end

  it "creates a new anycastip" do
    resp = subject.create(@anyc, @anycastip)
    expect(resp["ip"]).to eql(@anycastip)
  end

  it "lists all anycastips" do
    subject.create(@anyc, @anycastip)

    list = subject.list.map{|dc| dc["ip"]}

    expect(list).to include(@anycastip)
  end

  it "shows a single anycastip by uuid" do
    resp = subject.create(@anyc, @anycastip)
    show = subject.show(resp["id"])

    expect(show["ip"]).to eql(@anycastip)
  end

  it "deletes a anycastip" do
    id = subject.create(@anyc, @anycastip)["id"]
    subject.delete(id)

    list = subject.list.map{|dc| dc["ip"]}
    expect(list).to_not include(@anycastip)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simplenet-client-0.2.0 ./spec/simplenet/client/anycastip_spec.rb