Sha256: 98763fc66fb84347b0039fc2144a6aba773bf447147b23525815042a61a03fd3

Contents?: true

Size: 1.58 KB

Versions: 32

Compression:

Stored size: 1.58 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')

shared_examples_for "real or mock get_versions requests" do

  subject { @vcloud }

  it { should respond_to :get_versions }

  describe "#get_versions" do
    subject { @vcloud.get_versions( @vcloud.versions_uri ) }

    it_should_behave_like "all responses"

    describe "body" do
      subject { @vcloud.get_versions( @vcloud.versions_uri ).body }

      it { should have(4).keys }
      it_should_behave_like "it has the standard xmlns attributes"   # 2 keys

      its(:xmlns) { should == "http://www.vmware.com/vcloud/versions" }

      its(:VersionInfo) { should be_either_a_hash_or_array }

      describe ":VersionInfo" do
        subject { arrayify(@vcloud.get_versions( @vcloud.versions_uri ).body[:VersionInfo]) }

        specify {
          subject.each do |version_info|
            version_info.should include(:LoginUrl)
            version_info[:LoginUrl].should be_a_url
            version_info.should include(:Version)
            version_info[:Version].should be_an_instance_of String
          end
        }
      end
    end
  end
end

if Fog.mocking?
  describe Fog::Vcloud, :type => :mock_vcloud_request do

    it_should_behave_like "real or mock get_versions requests"

    describe "body" do
      subject { @vcloud.get_versions( @vcloud.versions_uri ).body }
      its(:VersionInfo) { should == { :LoginUrl => @mock_version[:login_url] , :Version => @mock_version[:version] } }
    end
  end
else
  describe Fog::Vcloud, :type => :vcloud_request do
    it_should_behave_like "real or mock get_versions requests"
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
fog-0.3.16 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.15 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.14 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.13 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.12 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.11 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.10 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.9 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.8 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.7 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.6 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.5 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.4 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.3 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.2 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.1 spec/vcloud/requests/get_versions_spec.rb
fog-0.3.0 spec/vcloud/requests/get_versions_spec.rb
fog-0.2.30 spec/vcloud/requests/get_versions_spec.rb
fog-0.2.28 spec/vcloud/requests/get_versions_spec.rb
fog-0.2.27 spec/vcloud/requests/get_versions_spec.rb