Sha256: 38b125ef2953cceb06a0b9e82ea6f29229a2a6999fa38a1b82157e267de3483a
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' require 'vagrant-cosmic/model/cosmic_resource' require 'vagrant-cosmic/service/cosmic_resource_service' include VagrantPlugins::Cosmic::Model include VagrantPlugins::Cosmic::Service describe CosmicResourceService do let(:cosmic_compute) { double('Fog::Cosmic::Compute') } let(:ui) { double('Vagrant::UI') } let(:service) { CosmicResourceService.new(cosmic_compute, ui) } before do response = { 'listkindsresponse' => { 'kind' => [{ 'id' => 'resource id', 'name' => 'resource name' }] } } allow(cosmic_compute).to receive(:send).with(:list_kinds, { 'id' => 'resource id' }).and_return(response) allow(cosmic_compute).to receive(:send).with(:list_kinds, {}).and_return(response) allow(ui).to receive(:detail) allow(ui).to receive(:info) end describe '#sync_resource' do it 'retrives the missing name' do resource = CosmicResource.new('resource id', nil, 'kind') service.sync_resource(resource) expect(resource.name).to be_eql 'resource name' expect(resource.id).to be_eql 'resource id' end it 'retrives the missing id' do resource = CosmicResource.new(nil, 'resource name', 'kind') service.sync_resource(resource) expect(resource.id).to be_eql 'resource id' expect(resource.name).to be_eql 'resource name' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagrant-cosmic-0.2.0 | spec/vagrant-cosmic/service/cosmic_resource_service_spec.rb |
vagrant-cosmic-0.1.0 | spec/vagrant-cosmic/service/cosmic_resource_service_spec.rb |