# -*- encoding: utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Simplenet::Client::Anycast do before(:all) do @conf = {:url => "http://localhost:8081"} @conn = Simplenet::Client::Connection.new(@conf) end before do @cidr = random_cidr end subject { @conn.anycasts } it "creates a new anycast" do resp = subject.create(@cidr) expect(resp["cidr"]).to eql(@cidr) end it "lists all anycasts" do subject.create(@cidr) list = subject.list.map{|dc| dc["cidr"]} expect(list).to include(@cidr) end it "shows a single anycast by uuid" do resp = subject.create(@cidr) show = subject.show(resp["id"]) expect(show["cidr"]).to eql(@cidr) end it "deletes a anycast" do id = subject.create(random_cidr)["id"] subject.delete(id) list = subject.list.map{|dc| dc["cidr"]} expect(list).to_not include(@cidr) end end