2011-02-17 13:44:46 -05:00
|
|
|
require 'ecloud/spec_helper'
|
2010-05-03 00:46:43 -04:00
|
|
|
|
2010-07-22 23:54:16 -04:00
|
|
|
shared_examples_for "real or mock get_versions requests" do
|
2011-02-25 15:22:49 -05:00
|
|
|
if Fog.mocking?
|
2010-07-22 23:54:16 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
subject { @vcloud }
|
2010-07-22 23:54:16 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
it { should respond_to(:get_versions) }
|
2010-05-03 00:46:43 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
describe "#get_versions" do
|
|
|
|
subject { @vcloud.get_versions( @vcloud.versions_uri ) }
|
2010-05-03 00:46:43 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
it_should_behave_like "all responses"
|
2010-05-03 00:46:43 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
describe "body" do
|
|
|
|
subject { @vcloud.get_versions( @vcloud.versions_uri ).body }
|
2010-05-03 00:46:43 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
it { should have(4).keys }
|
|
|
|
it_should_behave_like "it has the standard xmlns attributes" # 2 keys
|
2010-05-03 00:46:43 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
its(:xmlns) { should == "http://www.vmware.com/vcloud/versions" }
|
2010-05-03 00:46:43 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
its(:VersionInfo) { should be_either_a_hash_or_array }
|
2010-05-03 00:46:43 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
describe ":VersionInfo" do
|
|
|
|
subject { arrayify(@vcloud.get_versions( @vcloud.versions_uri ).body[:VersionInfo]) }
|
2010-07-22 23:54:16 -04:00
|
|
|
|
2011-02-25 15:22:49 -05:00
|
|
|
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
|
2010-06-17 19:58:09 -04:00
|
|
|
end
|
2010-05-03 00:46:43 -04:00
|
|
|
end
|
2011-02-25 15:22:49 -05:00
|
|
|
|
2010-05-03 00:46:43 -04:00
|
|
|
end
|
2010-07-22 23:54:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if Fog.mocking?
|
2011-02-17 13:44:46 -05:00
|
|
|
describe Fog::Ecloud, :type => :mock_tmrk_ecloud_request do
|
2010-07-22 23:54:16 -04:00
|
|
|
|
|
|
|
it_should_behave_like "real or mock get_versions requests"
|
|
|
|
|
|
|
|
describe "body" do
|
|
|
|
subject { @vcloud.get_versions( @vcloud.versions_uri ).body }
|
2010-10-17 19:06:44 -04:00
|
|
|
its(:VersionInfo) { should == { :LoginUrl => @mock_version.login_url , :Version => @mock_version.version } }
|
2010-07-22 23:54:16 -04:00
|
|
|
end
|
|
|
|
end
|
2010-06-17 19:58:09 -04:00
|
|
|
else
|
2011-02-17 13:44:46 -05:00
|
|
|
describe Fog::Ecloud, :type => :mock_tmrk_ecloud_request do
|
2010-07-22 23:54:16 -04:00
|
|
|
it_should_behave_like "real or mock get_versions requests"
|
|
|
|
end
|
2010-05-03 00:46:43 -04:00
|
|
|
end
|