Sha256: 8a4debb9b399686348cf8f38d41785072e2d441d0b8d295500a96e8823e38bee

Contents?: true

Size: 1.48 KB

Versions: 6

Compression:

Stored size: 1.48 KB

Contents

require "spec_helper"

describe "Fog::Vcloud, initialized w/ the TMRK Ecloud module", :type => :tmrk_ecloud_request do
  subject { @vcloud }

  it { should respond_to :get_public_ips }

  describe "#get_public_ips" do
    context "with a valid public_ips_uri" do
      before { @public_ips = @vcloud.get_public_ips(URI.parse(@mock_vdc[:href] + "/publicIps")) }
      subject { @public_ips }

      it_should_behave_like "all requests"

      its(:headers) { should include "Content-Type" }
      specify { subject.headers['Content-Type'].should == "application/vnd.tmrk.ecloud.publicIpsList+xml" }

      its(:body) { should be_an_instance_of Struct::TmrkEcloudList }

      describe "#body" do
        describe "#links" do
          subject { @public_ips.body.links }

          it { should have(3).ips }

          [0,1,2].each do |idx|
            let(:ip) { subject[idx] }
            let(:mock_ip) { @mock_vdc[:public_ips][idx] }
            specify { ip.should be_an_instance_of Struct::TmrkEcloudPublicIp }
            specify { ip.name.should == mock_ip[:name] }
            specify { ip.id.should == mock_ip[:id] }
            specify { ip.href.should == URI.parse("#{@base_url}/extensions/publicIp/#{mock_ip[:id]}") }
          end
        end
      end
    end

    context "with a public_ips_uri that doesn't exist" do
      subject { lambda { @vcloud.get_public_ips(URI.parse('https://www.fakey.c/piv8vc99')) } }

      it_should_behave_like "a request for a resource that doesn't exist"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-0.2.0 spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb
fog-0.1.10 spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb
fog-0.1.9 spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb
fog-0.1.8 spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb
fog-0.1.7 spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb
fog-0.1.6 spec/vcloud/terremark/ecloud/requests/get_public_ips_spec.rb