Sha256: a82cc781029c009f225facf293355d7b50160a44c5abad71bc1709367d9902f4

Contents?: true

Size: 1.94 KB

Versions: 30

Compression:

Stored size: 1.94 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))

Shindo.tests("Compute::VcloudDirector | catalog_items", ['vclouddirector', 'all']) do
  pending if Fog.mocking?

  pending if catalog.nil?
  catalog_items = catalog.catalog_items
  pending if catalog_items.empty?
  tests("#There is one or more catalog item").returns(true) { catalog_items.size >= 1 }
  catalog_item = catalog_items.first

  tests("Compute::VcloudDirector | catalog_item") do
    tests("#id").returns(String){ catalog_item.id.class }
    tests("#name").returns(String){ catalog_item.name.class }
    tests("#href").returns(String){ catalog_item.href.class }
    tests("#type").returns("application/vnd.vmware.vcloud.catalogItem+xml"){ catalog_item.type }
    tests("#vapp_template").returns(VappTemplate){ catalog_item.vapp_template.class }
  end

  tests("Compute::VcloudDirector | catalog_item", ['lazy load attrs']) do
    catalog_item.lazy_load_attrs.each do |lazy_attr|
      tests("##{lazy_attr} is not loaded yet").returns(NonLoaded) { catalog_item.attributes[lazy_attr] }
    end
  end

  tests("Compute::VcloudDirector | catalog_item", ['load on demand']) do
    tests("#description is not loaded yet").returns(NonLoaded) { catalog_item.attributes[:description] }
    tests("#description is loaded on demand").returns(String) { catalog_item.description.class }
    tests("#description is now loaded").returns(true) { catalog_item.attributes[:description] != NonLoaded }
  end

  tests("Compute::VcloudDirector | catalog_item", ['lazy load attrs']) do
    catalog.lazy_load_attrs.each do |lazy_attr|
      tests("##{lazy_attr} is now loaded").returns(true) { catalog_item.attributes[lazy_attr] != NonLoaded }
    end
  end

  tests("Compute::VcloudDirector | catalog_item", ['get']) do
    tests("#get_by_name").returns(catalog_item.name) { catalog_items.get_by_name(catalog_item.name).name }
    tests("#get").returns(catalog_item.id) { catalog_items.get(catalog_item.id).id }
  end
end

Version data entries

30 entries across 28 versions & 4 rubygems

Version Path
fog-2.3.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-vcloud-director-0.3.1 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-ifeel-2.2.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-2.2.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-2.1.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-vcloud-director-0.3.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/tests/vcloud_director/models/compute/catalog_items_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/tests/vcloud_director/models/compute/catalog_items_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-1.42.1 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-vcloud-director-0.2.2 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-vcloud-director-0.2.1 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-vcloud-director-0.2.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-vcloud-director-0.1.10 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-vcloud-director-0.1.9 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-2.0.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-1.42.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-1.41.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-1.40.0 tests/vcloud_director/models/compute/catalog_items_tests.rb
fog-1.39.0 tests/vcloud_director/models/compute/catalog_items_tests.rb