Sha256: 803be44679c6d45c85921a311c159f827ae35ba1a300fb2b8c88567627759357

Contents?: true

Size: 1.65 KB

Versions: 12

Compression:

Stored size: 1.65 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Fog::Vcloud, :type => :vcloud_request do
  subject { @vcloud }

  it { should respond_to :get_organization }

  describe "#get_organization" do
    context "with a valid organization uri" do
      before { @organization = @vcloud.get_organization(@vcloud.default_organization_uri) }
      subject { @organization }

      it_should_behave_like "all requests"

      its(:headers) { should include "Content-Type" }
      its(:body) { should be_an_instance_of Struct::VcloudOrganization }

      describe :headers do
        let(:header){ @organization.headers["Content-Type"] }
        specify{ header.should == "application/vnd.vmware.vcloud.org+xml" }
      end

      describe "#body" do
        subject { @organization.body }

        it_should_behave_like "it has a vcloud v0.8 xmlns"

        its(:links) { should have(@mock_organization[:vdcs].length * 3).links }
        its(:name) { should == @mock_organization[:info][:name] }
        its(:href) { should == @mock_organization[:info][:href] }

        let(:link) { subject.links[0] }
        specify { link.should be_an_instance_of Struct::VcloudLink }
        specify { link.rel.should == "down" }
        specify { link.href.should == @mock_vdc[:href] }
        specify { link.type.should == "application/vnd.vmware.vcloud.vdc+xml" }
        specify { link.name.should == @mock_vdc[:name] }
      end
    end
    context "with an organization uri that doesn't exist" do
      subject { lambda { @vcloud.get_organization(URI.parse('https://www.fakey.com/api/v0.8/org/999')) } }
      it_should_behave_like "a request for a resource that doesn't exist"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fog-0.1.4 spec/vcloud/requests/get_organization_spec.rb
fog-0.1.3 spec/vcloud/requests/get_organization_spec.rb
fog-0.1.2 spec/vcloud/requests/get_organization_spec.rb
fog-0.1.1 spec/vcloud/requests/get_organization_spec.rb
fog-0.1.0 spec/vcloud/requests/get_organization_spec.rb
fog-0.0.100 spec/vcloud/requests/get_organization_spec.rb
fog-0.0.99 spec/vcloud/requests/get_organization_spec.rb
fog-0.0.98 spec/vcloud/requests/get_organization_spec.rb
fog-0.0.97 spec/vcloud/requests/get_organization_spec.rb
fog-0.0.96 spec/vcloud/requests/get_organization_spec.rb
fog-0.0.95 spec/vcloud/requests/get_organization_spec.rb
fog-0.0.94 spec/vcloud/requests/get_organization_spec.rb